/*php升级后的7.4版本性能真的好到爆炸,可是依然会有个别的兼容性问题,比如
Php-fpm的新选项ProtectHome会导致经典的File not found错误,再是Php解释器
会对null类型的下标访问直接报错Trying to access array offset on value
of type null;*/
//版本问题,版本7.4以后PHP解析器会对null类型的下标访问直接报错:
//Trying to access array offset on value of type null;
//假如$data[$name]会出现null,改写后的代码:
function user($name, $user = null)
static $data
Trying to access array offset on value of type null(PHP的版本兼容问题)
最新推荐文章于 2024-06-17 14:32:10 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)