标签: count entity cakephp-3.0
我想用Cakephp 3.0计算实体数量,所以,我读了这本书,然后找到了查询 $number = $this->Models->find()->where(['variables' => 1])->count(); 但现在,如何查看我视图中的实体数量?
$number = $this->Models->find()->where(['variables' => 1])->count();
我有:
$this->set(compact('number'));
谢谢!
答案 0 :(得分:0)
只需在您的视图中使用此功能:<?=$number?>
<?=$number?>