-3

请告诉我怎么了?

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/'));
    };
}

谢谢

4

2 回答 2

0

利用

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

代替

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

于 2021-03-01T11:25:12.133 回答
0

这条线是什么? if (count($temp) == 1) { "this countable" 你必须先删除“这个可数”你可以发布错误吗?

于 2021-03-01T10:50:07.300 回答