我的电脑上有这个代码routes.php
执行重定向的文件。虽然问题是每当我跑步时php artisan route:cache
命令,它给了我一个错误Unable to prepare route [article/{params}] for serialization. Uses Closure.
我知道这与路由在有闭包时不允许缓存有关。但我该如何解决这个重定向呢?
Route::get('article/{params}', function($params) {
return Redirect::to($params, 301);
});
Since Laravel 5.5
您可以使用:
Route::redirect('/here', '/there', 301);
See the 文档 https://laravel.com/docs/5.5/routing#basic-routing under 重定向路线.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)