我刚开始学习Laravel框架,并且遇到了路由问题。Laravel路线不工作?
正在工作的唯一路线是开箱即用的Laravel附带的默认主路线。
我在Windows上使用WAMP,它使用PHP 5.4.3和Apache 2.2.22,并且我也启用了mod_rewrite,并从application.php配置文件中删除了'index.php'以离开一个空的字符串。
我已经创建了一个名为用户新的控制器:
class User_Controller extends Base_Controller {
public $restful = true;
public function get_index()
{
return View::make('user.index');
}
}
我创建了一个应用程序/视图/用户/视图文件名为的index.php有一些基本的HTML代码,在routes.php文件我已经添加了以下内容:
Route::get('/', function()
{
return View::make('home.index');
});
Route::get('user', function()
{
return View::make('user.index');
});
到工程第一条路线罚款参观我的网页浏览器的根目录(http://localhost/mysite/public
)时,但是当我尝试去我塞康d路线与http://localhost/mysite/public/user
我收到404 Not Found错误。为什么会发生这种情况?
你的'.htaccess'如何? – Michelle 2012-08-03 07:48:29
.htaccess是未修改的,就像它是开箱即用的。 – JasonMortonNZ 2012-08-03 07:51:35
看来WAMP是个问题。现在已经改为XAMPP,并且一切都很好,并且应该如此。我是否应该自问这个问题,解释WAMP是个问题? – JasonMortonNZ 2012-08-04 02:48:49