Question

Ce que j'ai fait:

  1. ) Téléchargé Swift-4.1.5.Tar
  2. ) L'extrait
  3. ) Téléchargé sur mon hôte dans / public_html / domaine / lib à l'aide de filezilla
  4. ) A fait un nouveau script en utilisant le code ci-dessous.
  5. ) L'a ouvert dans le navigateur et j'ai obtenu l'erreur suivante ci-dessous

Ma question est donc de savoir comment obtenir l'erreur que le fichier n'existe pas s'il y a 100%? Merci!

    <?php

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

    ?>

AVERTISSEMENT: require_once (/public_html/domain/lib/swift_required.php) [function.require-once]: a échoué à ouvrir le flux: aucun fichier ou répertoire dans /home/myuser/public_html/domain/email.php sur la ligne 5

Erreur fatale: require_once () [function.require]: ouverture échouée requise '/public_html/domain/lib/swift_required.php' (include_path = '.: / Usr / lib / php: / usr / local / lib / php') dans /home/myuser/public_html/domain/email.php sur la ligne 5

Voici une capture d'écran de mon dir de Filezilla.http://i.imgur.com/zsy8y.jpg

Était-ce utile?

La solution

C'est faux:

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

Utiliser à la place:

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

OU:

// 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';

OU:

// 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';
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top