【发布时间】:2015-12-17 09:27:03
【问题描述】:
我在 Laravel 5.0 中使用路由时出现问题,我只需要调用这个路由:
Route::get('home', 'HomeController@index');
但是当我写http://localhost/course/public/home时浏览器会显示这个:
Not Found
The requested URL /course/public/home was not found on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80
如果我写http://localhost/course/public/ 索引有效,但其他路线无效,我不知道为什么。
在我的 Routes.php 中有这个:
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
我只用composer下载了laravel 5.0,下载后代码没有做任何改动,我只想测试路由,这些都不行。
感谢您的帮助。
【问题讨论】:
-
是否有名为“public”的控制器?
-
你好 Gaurav Dave,控制器的名字是“HomeController”,public是索引所在的文件夹。
-
从 url 中删除 public 并转到 /course/home
-
我做到了,但错误是一样的。