警告:非法字符串偏移'订单'在functions-core.php中

时间:2014-05-20 07:11:17

标签: php wordpress

我使用的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;
}   

我真的希望有人可以帮我解决这个问题。

最诚挚的问候,

彼得

1 个答案:

答案 0 :(得分:0)

尝试检查密钥是否存在..

$ 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] );
    }