简体   繁体   English

为什么在Lumen项目中找不到类'Illuminate \\ Http \\ Resources \\ Json \\ JsonResource',如何在Lumen项目中添加JSON资源?

[英]Why does class 'Illuminate\Http\Resources\Json\JsonResource' not found in a Lumen project and how can I add JSON Resource in Lumen project?

use Illuminate\Http\Resources\Json\ResourceCollection;

works and can be retrieved inside a Lumen project. 可以在Lumen项目中进行检索。 But, using 但是,使用

 use Illuminate\\Http\\Resources\\Json\\JsonResource; 

will return 将返回

Class 'Illuminate\\Http\\Resources\\Json\\JsonResource' not found` 找不到类“ Illuminate \\ Http \\ Resources \\ Json \\ JsonResource”。

So, how can I add JsonResource inside a Lumen project? 那么,如何在Lumen项目中添加JsonResource

i think you can check your autoload_classmap.php in vendor/composer folder otherwise you simply use this use Illuminate\\Htt 我认为您可以在vendor / composer文件夹中检查autoload_classmap.php,否则您只需使用Illuminate \\ Htt 在此处输入图片说明 p\\Resources\\Json\\JsonResource; p \\资源\\ Json的\\ JsonResource;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM