我有products
桌子,想选择所有产品。这就是我所做的
$products = $this->Products->find('all', [
'conditions' => [
'status' => 1
]
]);
$this->set('products', $products);
并在已获取No product found
且未检索到产品时打印产品。
这就是我为此所做的
if (!empty($products)):
// show products
else:
echo 'No Products Found';
endif;
但这不起作用,即使没有找到产品,也不会打印其他条件。
如果条件甚至在控制器操作中都不起作用。有什么遗漏吗?
我正在使用 CakePHP 3.2