ここで問題があります。すべてのクラスの名前空間を作成しました。以前は、Windows 7を使用して現在のアプリを開発していましたが、すべて問題ありません。今私はubuntuに移動しました、問題が来ます。
index.php
spl_autoload_extensions(".php");
/*spl_autoload_register(function ($class) {
require __DIR__ . '/../' . $class . '.php';
});*/
//provided i have tried the above method, which works on windows 7 but not Ubuntu
spl_autoload_register(function ($class) {
require '/../' . $class . '.php';
});
//for your info, i do this
//require "../resources/library/Config.php";
//it works, no error
use resources\library as LIB;
use resources\dal as DAL;
//instantiation
$config = new LIB\Config();
print_r($config->fbKey());
このエラーが発生しました
PHP Warning: require(../resources\\library\\Config.php): failed to open stream: No such file or directory in /home/user/dir1/dir2/index.php
エラーが見つかりません。皆さんがこれで私を助けてくれることを願っています。どんな質問でも私が編集するコメントをすることを躊躇しないでください。前もって感謝します。
更新-追加情報
PHPバージョン5.4.6
最新の更新
str_replaceを使用せずにこれを解決する方法はありますか?JULPとMOONWAVEが答えを持っています!