[英]Laravel routing not working correctly
Quick question, 快速提问
EDIT: I do not know how to access other routes besides '/' Here are the routes I want to access 编辑:我不知道如何访问除“ /”以外的其他路由这是我要访问的路由
Route::get('/', 'HomeController@index');
Route::get('users', 'UserController@index');
Route::get('foo', function()
{
return 'Hello World';
});
Here is my routes. 这是我的路线。 Via php artisan routes
通过php artisan路线
I can successfully access localhost/cartraderlaravel/public It takes me to HomeController@index 我可以成功访问localhost / cartraderlaravel / public将我带到HomeController @ index
when I try to access foo or users I get 当我尝试访问foo或用户时,我得到
I have tried 我努力了
localhost/cartraderlaravel/public/users localhost/cartraderlaravel/users localhost/cartraderlaravel/foo localhost/cartraderlaravel/public/foo 本地主机/ cartraderlaravel /公共/用户本地主机/ cartraderlaravel /用户本地主机/ cartraderlaravel / foo本地主机/ cartraderlaravel /公共/ foo
All of these return a "Not Found" error. 所有这些都返回“未找到”错误。 Help anyone?
帮助任何人?
You should point your root directory to cartraderlaravel/public in WAMP so that you need not to visit localhost/cartraderlaravel/public. 您应该将根目录指向WAMP中的cartraderlaravel / public,这样就不必访问localhost / cartraderlaravel / public。 To do that in WAMP follow :
要在WAMP中执行以下操作:
Further research shows this is a common problem with WAMP. 进一步的研究表明,这是WAMP的常见问题。 Something to do with Apache settings.
与Apache设置有关。 I have moved to using a virtual network and everything works now
我已经开始使用虚拟网络,现在一切正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.