2014-04-21 64 views
1

我有一個錯誤,我認爲它與public_html文件的目錄有關,但我不確定。php無法打開流

的錯誤:

Warning: require(__DIR__/protected/bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home4/nameguy/public_html/index.php on line 21 

Warning: require(__DIR__/protected/bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home4/nameguy/public_html/index.php on line 21 

Fatal error: require() [function.require]: Failed opening required '__DIR__/protected/bootstrap/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home4/nameguy/public_html/index.php on line 21 

的index.php代碼:

<?php 
require __DIR__.'/protected/bootstrap/autoload.php'; 

$app = require_once __DIR__.'/protected/bootstrap/start.php'; 

$app->run(); 

$app->shutdown(); 

回答

2

__DIR__因爲PHP 5.3只被定義所以也許你有一箇舊版本。您可以使用__FILE__代替:

<?php 
require dirname(__FILE__).'/protected/bootstrap/autoload.php'; 

$app = require_once dirname(__FILE__).'/protected/bootstrap/start.php'; 
+0

現在我得到這個錯誤:http://pastebin.com/JT0xhR7s - 自動加載代碼:http://pastebin.com/pr5zRAHM |我並不是故意要求一切:3在PHP中,我只是迷失了方向,我發現已經回答的大多數問題都太高級了,不適合我當前的PHP – user3555497

+0

級別,請爲您的代碼提供一些解釋,以便用戶瞭解現在正在做? – zkanoca

+0

@zkanoca,我已經更新了我的答案,很可能'__DIR__'沒有爲他定義。 –