2013-12-15 78 views
2

我在本地主機安裝laravel +作曲,然後我試着用這段代碼塊運行基本routes.php文件:PHP Laravel框架路由錯誤

Route::get('/x', function() 
{ 
    return 'Hello World'; 
}); 

,然後我嘗試用這種http://localhost/laravel/app/x運行它和http://localhost/laravel/x

,我想趁自己這個錯誤類型:

Object not found! 

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. 

If you think this is a server error, please contact the webmaster. 

Error 404 

localhost 
Apache/2.4.4 (Unix) PHP/5.5.3 OpenSSL/1.0.1e mod_perl/2.0.8-dev Perl/v5.16.3 

我怎樣才能解決這個問題?

+0

在路由中刪除/之前的x。重新配置您的虛擬主機設置,將您的公共文件夾指向根目錄,這樣您就不必執行您對網址的操作。如果仍然有問題,請聯繫我gtalk sarmenhb(at)gmail(dot)com –

回答

1

所有的Laravel路線都通過公共文件夾。

假設您的項目名稱是Laravel,這應該工作。

http://localhost/laravel/public/x 
+0

routes.php文件 - > app/rotues.php所以公共不工作:( – user3026894

+0

嘗試chmod -R 777 laravel文件夾 – elliotanderson

+0

它解決了我的問題:) – Steve