我使用的Wordpress主题没有更新。但是,服务器有一个新版本的PHP。
问题是我不能登录到Wordpress;我看到这些错误:
Warning: Illegal string offset 'order' in /home/minne/domains/civ-lauwersoog.nl/public_html/wp-content/themes/civ/core/functions-core.php on line 19
Warning: Cannot modify header information - headers already sent by (output started at /home/minne/domains/civ-lauwersoog.nl/public_html/wp-content/themes/civ/core/functions-core.php:19) in /home/minne/domains/civ-lauwersoog.nl/public_html/wp-includes/pluggable.php on line 866
下一节中的第四行是第19行,它产生错误:
function yiw_subval_sort( $a, $subkey ) {
if( is_array( $a ) AND ! empty( $a ) ) {
foreach( $a as $k => $v ) {
$b[$k] = strtolower( $v[$subkey] );
}
asort( $b );
foreach( $b as $key => $val ) {
$c[] = $a[$key];
}
return $c;
}
return $a;
}
我真的希望有人能帮我解决这个问题。 最诚挚的问候,彼得
尝试检查键是否存在…
$b和$subkey没有在您提供的函数中定义。
function yiw_subval_sort( $a, $subkey ) {
if( is_array( $a ) AND ! empty( $a ) ) {
foreach( $a as $k => $v ) {
if( isset( $b[$k] ) && isset( $v[$subkey] ) )
$b[$k] = strtolower( $v[$subkey] );
}