[5.1.14] Loader.php判断vendor路径不准确

浏览:815 发布日期:2018/05/25
5.0.0 - 普通 - 未处理
thinkphp\library\think\Loader.php // 获取应用根目录
    public static function getRootPath()
    {
        if ('cli' == PHP_SAPI) {
            $scriptName = realpath($_SERVER['argv'][0]);
        } else {
            $scriptName = $_SERVER['SCRIPT_FILENAME'];
        }

        $path = realpath(dirname($scriptName));

        if (!is_file($path . DIRECTORY_SEPARATOR . 'think')) {
            $path = dirname($path);
        }

        return $path . DIRECTORY_SEPARATOR;
    }
如果是这种部署目录,就找不到composer安装的类库,报错/tp51/
/tp51/vendor
/public/index.php
index.phpdefine('APP_PATH', __DIR__ . '/../tp51/application');
require __DIR__ . '/../tp51/thinkphp/base.php';
Container::get('app', [APP_PATH])->run()->send();
评论()
后面还有条评论,点击查看>>