【发布时间】:2021-04-11 10:59:13
【问题描述】:
我正在编写我的第一个 laravel 包,因此我可以使用它并了解包的工作原理并学习如何编写包等。
但是我的项目无法识别我编写的包。
这是我的包 Github 链接:https://github.com/IIIphr/Shamsi_Calendar
这是我的主要项目:https://github.com/IIIphr/aimeos_shamsi
我使用此命令将我的包添加到应用程序:composer require iiiphr/shamsi_calendar
它会被成功添加(至少我猜)。然后在临时控制器中,我写了这个:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use iiiphr\shamsi_calendar;
class temp extends Controller
{
public function index(){
return shamsi_calendar::get_date();
}
}
还有一条路线:Route::get('/date','temp@index');
但是在http://localhost:8000/date,我会遇到这个错误:
之前,我尝试过其他方法,但结果都没有成功。
另一件事,我在临时控制器的 Visual Studio 代码中有这个错误:Undefined type 'iiiphr\shamsi_calendar'.intelephense(1009)
我将不胜感激任何形式的帮助:)
【问题讨论】: