lumen php环境升级到了7.3以上不兼容问题
Trying to access array offset on value of type null
[2021-05-06 20:19:14] lumen.ERROR: ErrorException: Trying to access array offset on value of type null in E:\PHPRoot\gancao_workgroup\gapis_medicine\vendor\illuminate\support\ServiceProvider.php:84
Stack trace:...
报错原因
/**
* Register a view file namespace.
*
* @param string|array $path
* @param string $namespace
* @return void
*/
protected function loadViewsFrom($path, $namespace)
{
if (is_array($this->app->config['view']['paths'])) {
foreach ($this->app->config['view']['paths'] as $viewPath) {
if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) {
$this->app['view']->addNamespace($namespace, $appPath);
}
}
}
$this->app['view']->addNamespace($namespace, $path);
}
解决方法
$app = new Laravel\Lumen\Application(
realpath(__DIR__.'/../')
);
//此处为增加的代码
if(version_compare(PHP_VERSION,'5.4.0','>=')){
$app->configure('view'); //bug fixd :In ServiceProvider.php line 84
}
评论 (0)