我无法访问我的WP(version3.4.2)管理员.它如上所述
Fatal error: Cannot re-assign auto-global variable _POST in /home/xxx/public_html/wp-content/themes/rtthemes16/rt-framework/classes/admin.PHP on line 540.
线540是:
function rt_check_sidebar_array($_POST){ if(is_array($_POST)){ $start_unset_count = 0; foreach($_POST as $key => $value){ if(stristr($key,'_sidebar_name') == TRUE && $value=="") { unset($_POST[$key]); $start_unset_count = 1; } if($start_unset_count>0){ unset($_POST[$key]); $start_unset_count++; } if($start_unset_count==6){ $start_unset_count = 0; } } } $newPost == $newPost ? $newPost : $_POST; return $_POST; }
任何见解?
谢谢 :)
由于PHP 5.4,您不能使用超全局作为函数的参数
原文链接:https://www.f2er.com/php/139701.html$_POST是全球可访问的.所以你不必传递给你的功能.
http://php.net/manual/en/language.variables.superglobals.php#112184
这是你的功能应该如何
function rt_check_sidebar_array(){ if(is_array($_POST)){ $start_unset_count = 0; foreach($_POST as $key => $value){ if(stristr($key,'_sidebar_name') == TRUE && $value=="") { unset($_POST[$key]); $start_unset_count = 1; } if($start_unset_count>0){ unset($_POST[$key]); $start_unset_count++; } if($start_unset_count==6){ $start_unset_count = 0; } } } $newPost == $newPost ? $newPost : $_POST; return $_POST; }