请教 php artisan migrate报错 如何处理

1. 运行环境

1). 当前使用的 Laravel 版本?

Laravel 5.5.50

2). 当前使用的 php/php-fpm 版本?

PHP 版本:PHP 8.1.2 (cli)

php-fpm 版本:

3). 当前系统

Linux version 5.15.0-47-generic (buildd@lcy02-amd64-060) (gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.38)

4). 业务环境

5). 相关软件版本

2. 问题描述?

user@IsomirWindow:~/Downloads/IsomiR_Window_Built/opt/lampp/htdocs/isomirwindow$ php artisan migrate

PHP Warning: Undefined property: ReflectionNamedType::$name in /home/user/Downloads/IsomiR_Window_Built/opt/lampp/htdocs/isomirwindow/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 885
PHP Fatal error: Uncaught ReflectionException: Class “” does not exist in /home/user/Downloads/IsomiR_Window_Built/opt/lampp/htdocs/isomirwindow/vendor/laravel/framework/src/Illuminate/Container/Container.php:752

 public function build($concrete)
    {
        // If the concrete type is actually a Closure, we will just execute it and
        // hand back the results of the functions, which allows functions to be
        // used as resolvers for more fine-tuned resolution of these objects.
        if ($concrete instanceof Closure) {
            return $concrete($this, $this->getLastParameterOverride());
        }

        $reflector = new ReflectionClass($concrete); //line752

        // If the type is not instantiable, the developer is attempting to resolve
        // an abstract type such as an Interface of Abstract Class and there is
        // no binding registered for the abstractions so we need to bail out.
        if (! $reflector->isInstantiable()) {
            return $this->notInstantiable($concrete);
        }

        $this->buildStack[] = $concrete;

        $constructor = $reflector->getConstructor();

        // If there are no constructors, that means there are no dependencies then
        // we can just resolve the instances of the objects right away, without
        // resolving any other types or dependencies out of these containers.
        if (is_null($constructor)) {
            array_pop($this->buildStack);

            return new $concrete;
        }

3. 您期望得到的结果?

4. 您实际得到的结果?

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 10

php换7.3试试

1年前 评论
lapchin (楼主) 1年前
working (作者) 1年前

额,你程序应该都跑不起来吧,Laravel 5.5.50 用 PHP 8.1

1年前 评论
随波逐流

laravel 版本太低了,要么升 laravel 版本, 要么降低 php 版本

1年前 评论
new \ReflectionClass("");
// Fatal error: Uncaught ReflectionException: Class "" does not exist
1年前 评论
lapchin (楼主) 1年前
php_yt (作者) 1年前
rm -rf vendor
rm -rf composer.lock
composer install

操作前务必备份 vendor composer.json composer.lock,有些扩展更新了可能系统不兼容,需要自己逐一去处理,理论来讲不会太多的。

1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!