安装html生成器laravelcollective/html
composer require laravelcollective/html
时,报错
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravelcollective/html ^5.8 -> satisfiable by laravelcollective/html[v5.8.0].
- Conclusion: remove laravel/framework v5.4.36
- Conclusion: don't install laravel/framework v5.4.36
- laravelcollective/html v5.8.0 requires illuminate/view 5.8.* -> satisfiable by illuminate/view[v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.3, v5.8.4, v5.8.8, v5.8.9].
解决:
"laravel/framework": "5.8.*",
又报错:
In Route.php line 917: Unable to prepare route [api/user] for serialization. Uses Closure.
参考:https://blog.csdn.net/qq_39479575/article/details/78637743
③找到routes/api.php,暂时注释以下代码:
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
又报错:
In Route.php line 917: Unable to prepare route [/] for serialization. Uses Closure.
参考:https://www.fujieace.com/laravel/route-2.html
1、创建laravel 项目时候。web.php 路由文件,里边有个默认的 welcome欢迎页;
Route::get('/', function()
{
return veiw('welcome');
});
修改为
Route::get('/', 'HomeController@index');
然后就OK了