public $form = array (
array(
'field' => 'email',
'params' => array(
array(
'rule' => 'email',
'on' => 'create',
'required' => true,
'error' => 'The email is invalid!'
),
array(
'rule' => 'email',
'on' => 'update',
'required' => false,
'error' => 'The email is invalid!'
)
)
)
);
public function onlyNeeded($action) {
$form = $this->form;
$action = $this->action;
foreach ($form as $formelement) {
$field = $formelement['field'];
$paramsgroup = $formelement['params'];
if ($paramsgroup['on'] != $action) {
form = removeparamsgroup($form, $action);
}
}
return $form;
}
我该如何做这个removeparamsgroup()
功能?
有 [index] ,而不仅仅是 [name]!
你懂我的意思吗?
数组(数组(两次!