2013-12-15 43 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