我刚刚建立了一个新的laravel 4项目,我似乎无法让我的路线工作。
我在routes.php文件中有以下代码。
Route::get('test', function()
{
return 'test';
});
Route::get('/', function()
{
return View::make('hello');
});
但是如果我去localhost:8888 / laravel4我得到一个目录列表而不是'/'路由。
如果我去localhost:8888 / laravel4 / test我得到The requested URL /laravel4/test was not found on this server.
我正在使用MAMP和php 5.5.3作为我的localhost。
答案 0 :(得分:1)
入口点位于公共目录
中所以你去
localhost:8888/laravel4/public/
得到/路线
和
localhost:8888/laravel4/public/test
到测试路线。
否则,您应该设置一个虚拟主机(不知道如何在Mac中执行)并将其指向您的laravel项目的公共目录