PHP程序换了个服务器后,报错:Array and string offset access syntax with curly braces is deprecated
,这是因为PHP7.4版本之后不再支持使用大括号{}访问数组以及字符串的偏移,必须统一使用中括号[]。
错误:
$seq = (ord($value{0}) % $rule['num']) + 1;
正确:
$seq = (ord($value[0]) % $rule['num']) + 1;
注意红色位置。
PHP程序换了个服务器后,报错:Array and string offset access syntax with curly braces is deprecated
,这是因为PHP7.4版本之后不再支持使用大括号{}访问数组以及字符串的偏移,必须统一使用中括号[]。
错误:
$seq = (ord($value{0}) % $rule['num']) + 1;
正确:
$seq = (ord($value[0]) % $rule['num']) + 1;
注意红色位置。