Domanda

Cosa ho fatto:

  1. ) Swift-4.1.5.tar scaricato
  2. ) Estratto
  3. ) Caricato sul mio host in / public_html / domain / lib utilizzando FileZilla
  4. ) Crea un nuovo script utilizzando il codice seguente.
  5. ) L'ho aperto nel browser e ho ricevuto il seguente errore di seguito

Quindi la mia domanda è: come ricevo l'errore che il file non esiste se è al 100%?Grazie!

    <?php

      require_once '/public_html/domain/lib/swift_required.php';

    ?>

Avviso: require_once (/public_html/domain/lib/swift_required.php) [function.require-once]: impossibile aprire lo stream: nessun file o directory di questo tipo in /home/myuser/public_html/domain/email.php suriga 5

Errore irreversibile: require_once () [function.require]: apertura non riuscita richiesta '/public_html/domain/lib/swift_required.php' (include_path= '.: / usr / lib / php: / usr / local / lib /php ') in /home/myuser/public_html/domain/email.php sulla riga 5

Ecco uno screenshot della mia directory da FileZilla. http://i.imgur.com/Zsy8y.jpg

È stato utile?

Soluzione

Questo è sbagliato:

// this is absolute path, just like /home/user or /var/www
require_once '/public_html/domain/lib/swift_required.php'; 

Utilizza invece:

// this is relative path to the current file
require_once 'public_html/domain/lib/swift_required.php'; //notice: no '/' in the beggining

OPPURE:

// so use this one if you know the whole path to the file
require_once ABSOLUTE_PATH_TO . 'public_html/domain/lib/swift_required.php';

OPPURE:

// or use this one if you don't know the whole path
// or if the path will change (dev machine and production machine)
require_once dirname(__FILE__) . RELATIVE_PATH_TO . 'public_html/domain/lib/swift_required.php';
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top