别名是在运行时注册的,因此它们不在命名空间中,Intelephense无法捕捉到它们。
请参阅在Github上Intelephense项目上提出的问题https://github.com/bmewburn/vscode-intelephense/issues/1116
"这些类在工作区中不存在。Laravel在运行时创建它们。因此,它们被报告为未定义。解决方法是要么提供存根定义https://github.com/barryvdh/laravel-ide-helper,要么关闭诊断(intelephense.diagnostics.undefinedTypes)."
web.php
文件顶部是否有use Illuminate\Support\Facades\Route;
语句? - Andrew