PHP7.4报错"Array and string offset access syntax with curly braces is deprecated"的解决方法

发表于 2020-01-02 04:27:56, 最后编辑于2020-02-28 04:21:03 (UTC+0)

PHP7.4以前的PHP, 获取数组元素有2种格式, 比如

$arr = ['a','b','c'];
$e = $arr[0]; //第1种格式
$e = $arr{0}; //第2种格式; PHP7.4不支持这种大括号格式

第2种格式在PHP7.4中不能使用.

所以, ThinkPHP5.0是不支持PHP7.4的. 因为TP5的Query.php中有这样一段代码

0.095384s