TP6首页加载报错 Call to a member function run() on null

最近新接入一个二开的项目,tp6的项目内置的composer.json文件里引入的topthink框架包文件却是"topthink/framework": "5.0.*",导致了以下错误:

错误

Fatal error: Uncaught Error: Call to a member function run() on null in /www/wwwroot/www.test.com/public/index.php:29 Stack trace: #0 {main} thrown in /www/wwwroot/www.test.com/public/index.php on line 29

解决

修改composer.json文件如下:

{
    "name": "topthink/think",
    "description": "the new thinkphp framework",
    "type": "project",
    "keywords": [
        "framework",
        "thinkphp",
        "ORM"
    ],
    "homepage": "http://thinkphp.cn/",
    "license": "Apache-2.0",
    "authors": [
        {
            "name": "liu21st",
            "email": "[email protected]"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "topthink/framework": "5.0.*",
        "alibabacloud/client": "^1.5"
    },
    "autoload": {
        "psr-4": {
            "app\\": "application"
        }
    },
    "extra": {
        "think-path": "thinkphp"
    },
    "config": {
        "preferred-install": "dist"
    }
}

执行composer update 更新 vendor文件,问题解决。

你可能感兴趣的:(1024程序员节,tp6,tp5)