PHP 7 升级到Php8 ,worpress 出现的主题错误
-
0
rocky
Warning: Attempt to read property "term_id" on string in /xxxxxx/wp-content/themes/milu/functions.php on line 637
Warning: Undefined array key 0 in /xxxxx/wp-content/themes/milu/functions.php on line 706
Warning: Attempt to read property "term_id" on null in /xxxxxx/wp-content/themes/milu/functions.php on line 707
出现未定义的键值
2 Subscribers




Submit Answer
1 Answers
最佳答案
0


Warning: Undefined array key
$cat = isset($cat[0]) ? $cat[0] : '';
php8 更严谨一些,需要判断一下变量赋值是否为空,可以用 isset() ? : 三元运算符来解决