【发布时间】:2015-01-22 22:47:30
【问题描述】:
我正在使用最新的 cakephp2。在一个控制器中,我有多个动作。
例如
OrderController.php
public function save_1(){
//check validate of model and save
}
public function save_2(){
//check validate of model and save
}
在模型中:
Order.php
public $validate = array(
'name' => array(
'rule' => 'notEmpty',
'message' => 'Please enter Name'
)
);
在我的控制器的函数 save_1 中,我需要检查名称。那份工作。
但在 save_2 函数中,我只需要检查地址。
如何仅使用 1 个模型进行多次验证?
谢谢你的回答,对不起我的英语..
【问题讨论】: