Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从表中获取单个字段值,以便我可以比较该布尔值并检查条件。如何从 cakephp 的表中获取特定字段?
是的,您可以根据条件获取特定字段,使用模型的字段方法。
$this->YourModel->field('field', $yourconditionsarray);
例如:
$this->Post->field('name', array('id' => 20));
上面给出了 id 20 的帖子名称。