Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 拉维路不工作_Php_Laravel - Fatal编程技术网

Php 拉维路不工作

Php 拉维路不工作,php,laravel,Php,Laravel,我有这条路线 Route::get('/', function() { return 'foo'; //return View::make('hello'); //return View::make('world'); }); 当我键入http://localhost/laravel/,它显示foo 但是 随着这场溃败 Route::get('about', function() { return 'foo'; //retu

我有这条路线

Route::get('/', function()
{
     return 'foo';
    //return View::make('hello');
    //return View::make('world');
});
当我键入
http://localhost/laravel/
,它显示
foo

但是

随着这场溃败

 Route::get('about', function()
    {
         return 'foo';
        //return View::make('hello');
        //return View::make('world');
    });
http://localhost/laravel/about
,我明白了
在此服务器上找不到请求的URL/laravel/about


请告诉我这里发生了什么。

当您使用链接时:
localhost/laravel/index.php/about
route-works。这意味着您正在正确定义它们。问题出在服务器端。确保您的
mod_rewrite
模块已启用

您正在使用Wamp。请尝试按照以下说明操作:

不,它不起作用。即使我这样做
route::get('',function()
而不是
route::get('/',function()),路由也会工作
Wow这真的很管用。但是请你怎么解释。这里的答案解释了这一点。你没有启用mod_rewrite功能。你使用哪种服务器?如果这是其他Apache服务器,你需要将请求重定向到index.php;就像在Its Apache中一样,我使用的是Wamp