PHP count():参数必须是实现Countable的数组或对象

问题描述 投票:0回答:1

这是文件中我的代码的摘录public_html / wp-content / themes / arabv3 / CustomMetaBox / CMB2.php,从第565行开始

        // if it's an array of one, extract it
    elseif ( is_array( $this->prop( 'object_types' ) ) && count( $this->prop( 'object_types' ) === 1 ) ) {
        $cpts = $this->prop( 'object_types' );
        $type = is_string( end( $cpts ) )
            ? end( $cpts )
            : false;
    }

当我运行代码时,出现以下错误:

PHP警告:count():参数必须是在[]中实现Countable的数组或对象。

[这是我的代码的摘录,位于文件public_html / wp-content / themes / arabv3 / CustomMetaBox / CMB2.php中,从第565行开始// //如果是一个数组,则将其提取elseif(is_array($ this- ...

php count
1个回答
0
投票

您的PHP版本?如果它的7.2那么count函数在计算stdclass时给您错误。

© www.soinside.com 2019 - 2024. All rights reserved.