[英]Problem with PHP “Message: count(): Parameter must be an array or an object that implements Countable ”
[英]Message: count(): Parameter must be an array or an object that implements Countable
请告诉我怎么了?
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/'));
};
}
谢谢
这条线是什么?
if (count($temp) == 1) { "this countable"
you must delete "this countable" first you can post the error?
利用
if (is_array($temp) && count($temp) == 1) { "这个可数"
代替
if (count($temp) == 1) { "这个可数"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.