简体   繁体   English

消息:count():参数必须是一个数组或实现 Countable 的 object

[英]Message: count(): Parameter must be an array or an object that implements Countable

Please tell me whats wrong?请告诉我怎么了?

public function view($link = null) {
    $temp = $this->BlogModel->getDetail('link', $link);
    
    if (count($temp) == 1) { "this countable"
        $data = array(
            'app' => $this->app(),
            'data' => $temp,
            'comments' => $this->BlogCommentModel->getAll(['blog_id' => $temp->id], 'id asc'),
            'data_latest' => $this->BlogModel->getLatest(6)
        );
        $this->BlogModel->updateVisitCount($link);
        $this->template->set('title', $data['data']->title . ' | ' . $data['app']->app_name, TRUE);
        $this->template->load_view($data['app']->template_frontend.'/detail', $data, TRUE);
        $this->template->render();
    } else {
        redirect(base_url('blog/'));
    };
}

Thank you谢谢

what is this line?这条线是什么? if (count($temp) == 1) { "this countable" you must delete "this countable" first can you post the error? if (count($temp) == 1) { "this countable" you must delete "this countable" first you can post the error?

use利用

if (is_array($temp) && count($temp) == 1) { "this countable" if (is_array($temp) && count($temp) == 1) { "这个可数"

instead of代替

if (count($temp) == 1) { "this countable" if (count($temp) == 1) { "这个可数"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP 出现问题“消息:count():参数必须是数组或实现可计数的 object” - Problem with PHP “Message: count(): Parameter must be an array or an object that implements Countable ” 消息:count():参数必须是在 centos 上实现可数 codeigniter 的数组或 object - Message: count(): Parameter must be an array or an object that implements Countable codeigniter on centos 消息:count():参数必须是一个数组或实现 codeigniter model 中的 Countable 的 object - Message: count(): Parameter must be an array or an object that implements Countable in codeigniter model count():参数必须是在其中实现Countable的数组或对象 - count(): Parameter must be an array or an object that implements Countable in 警告:count():参数必须是一个数组或一个实现 Countable 的对象 / if( count($query) ) { - Warning: count(): Parameter must be an array or an object that implements Countable / if( count($query) ) { Wordpress 错误:警告:count():参数必须是实现 Countable 的数组或对象 - Wordpress error: Warning: count(): Parameter must be an array or an object that implements Countable 流明count():参数必须是实现Countable的数组或对象 - Lumen count(): Parameter must be an array or an object that implements Countable count():参数必须是一个数组或在codeigniter中实现Countable的对象 - count(): Parameter must be an array or an object that implements Countable in codeigniter Drupal:count():参数必须是实现Countable的数组或对象 - Drupal: count(): Parameter must be an array or an object that implements Countable PHP警告:count():参数必须是数组或实现Countable的对象? - PHP Warning: count(): Parameter must be an array or an object that implements Countable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM