Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.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
Laravel路由匹配前缀后的所有内容_Laravel_Laravel 4_Laravel 5_Laravel Routing - Fatal编程技术网

Laravel路由匹配前缀后的所有内容

Laravel路由匹配前缀后的所有内容,laravel,laravel-4,laravel-5,laravel-routing,Laravel,Laravel 4,Laravel 5,Laravel Routing,我正在尝试匹配URL中的路径,如下所示 我的HTTP请求 http://localhost/myprefix/extra/x/x/x/x/x/2/3/2/ routes.php Route::group( ['prefix' => 'myprefix'], function () { Route::get('extra/{path}', ['as' => 'myprefix.one', 'uses' => 'MyController@index

我正在尝试匹配URL中的路径,如下所示

我的HTTP请求

http://localhost/myprefix/extra/x/x/x/x/x/2/3/2/
routes.php

Route::group(
    ['prefix' => 'myprefix'],
    function () {
        Route::get('extra/{path}', ['as' => 'myprefix.one', 'uses' => 'MyController@index']);
        Route::get('extraOTher/{path}', ['as' => 'myprefix.two', 'uses' => 'MyController@indexOther']);
    }
);
public function index($path)
{
    // $path should be extra/x/x/x/x/x/2/3/2/
}
MyController.php

Route::group(
    ['prefix' => 'myprefix'],
    function () {
        Route::get('extra/{path}', ['as' => 'myprefix.one', 'uses' => 'MyController@index']);
        Route::get('extraOTher/{path}', ['as' => 'myprefix.two', 'uses' => 'MyController@indexOther']);
    }
);
public function index($path)
{
    // $path should be extra/x/x/x/x/x/2/3/2/
}
这总是让我犯错误

NotFoundHttpException in RouteCollection.php line 145:
我怎样才能让它工作?我在某个地方读到关于:any and:all的文章,但我也没能让它们正常工作。

有点老套

Routes.php: 添加一个模式

Route::pattern('path', '[a-zA-Z0-9-/]+');
现在它将覆盖所有路线

Controller.php:
不优雅。但是它应该能起作用。

嗨,itachi,我不能让它继续工作,你确定它能工作吗>啊,不管它能不能工作!那是因为我有一个朋友。在我的道路上,非常感谢!也为我工作