0

我的 Wordpress 页面 (yarnhk.com) 出现以下几行:

警告:array_key_exists() 期望参数 2 是数组,字符串在第 482 行的 /home/yarnhrnm/public_html/wp-content/plugins/fusion-core/shortcodes/class-fullwidth.php 中给出

警告:array_key_exists() 期望参数 2 是数组,字符串在第 483 行的 /home/yarnhrnm/public_html/wp-content/plugins/fusion-core/shortcodes/class-fullwidth.php 中给出

fullwidth.php 文件第 482 和 483 行显示如下:

if ( ( array_key_exists( 'backgroundattachment', $args ) 
   && $args['backgroundattachment'] == 'scroll' ) 
   || ( array_key_exists( 'background_attachment', $args ) 
   && $args['background_attachment'] == 'scroll' )

这里有什么帮助吗?

4

2 回答 2

0

参数 2 为数组,给定字符串

错误消息说,您$args的不是数组而是普通字符串。查找变量的定义(当然还有任何意外覆盖)。

您应该使用var_dump($args);来输出 的类型和值$args

于 2015-06-02T14:00:41.507 回答
0

最后,我使用以下代码完成了它:

if( is_array($args) && ( array_key_exists( 'backgroundattachment', $args ) && $args['backgroundattachment'] == 'scroll' ) || is_array($args) && ( array_key_exists( 'background_attachment', $args ) && $args['background_attachment'] == 'scroll' )) { 
    // Something
}

完毕!

于 2015-06-03T10:50:12.323 回答