警告:functions-core.php 中的非法字符串偏移“order" [英] Warning: Illegal string offset 'order' in functions-core.php
本文介绍了警告:functions-core.php 中的非法字符串偏移“order"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是未更新的 Wordpress 主题.但是,服务器有新版本的 PHP.
I work with an Wordpress theme which is not being updated. However, the server has a new version of PHP.
问题是我无法登录Wordpress;我看到这些错误:
The problem is that I can not login to Wordpress; I see these errors:
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 行,它会产生错误:
This fourth line in the following section is line 19 which generates the error:
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;
}
我真的希望有人能帮我解决这个问题.
I really hope someone could help me out with this issue.
此致,
彼得
推荐答案
尝试检查键是否存在..
Try to check if the keys does exist ..
$b 和 $subkey 未在您提供的函数中定义.
$b and $subkey not defined inside the function you provided.
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] );
}
这篇关于警告:functions-core.php 中的非法字符串偏移“order"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文