require_once()またはinclude_once()を同じディレクトリに使用している間は問題はありません。しかし、私が以下のように使うと:Require_once()とinclude_once()が失敗する
私はPHPクラスページ名email.class.phpを持っています。
<?php
require_once('../../configuration.php'); //The file is outside of directory. (root/system/class/) where the configuration.php file is not in the class directory but in root directory
?>
は、今私はemail.class.phpは、以下のように含まれている購読フォームを持っています。
<?php
require_once('../class/email.class.php'); // Directory structure is like: (root/system/package/) // the formprocess.php is in the package folder.
?>
すべて正しいと思われます。しかし、私がフォームを処理しようとすると、致命的なエラー: require_onceは何かが示す必要な../../configuration.phpファイルを開くことができません。 次に、の代わりにURLを使用しようとしました。 '../..configuration.php'。しかし、私のホストはURLを開くことができません。問題はどこだ ?誰でも助けてください。私は単なる学習者です。
は 'GETCWD()'と 'のrealpath()を参照してください' – chelmertz