Zend 1.7을 사용하여 일부 데이터의 유효성을 검사하고 있습니다. 유효성 검사에 실패 forward
하면 다른 페이지로 이동합니다. 입력 유효성 검사가 실패 할 경우 생성 된 오류 메시지로 전달할 수 있습니까? 이 같은:
public function postAction() {
$newData = $this->getRequest ()->getPost ();
$validators = array ('name' => array ('presence' => 'required'));
$input = new Zend_Filter_Input(null, $validators);
$input->setData($newData);
if (!$input->isValid()) {
print_r($input->getErrors());
print_r($input->getMessages());
//here I want to pass the Erros and the Messages
return $this->_forward('action', 'controller', 'module');
}
}
의 네 번째 매개 변수를 forward()
사용하여 매개 변수를 전달할 수 있습니다.
return $this->_forward(
'action',
'controller',
'module',
array(
'errors' => $input->getErrors(),
'messages' => $input->getMessages()
)
);
완전한 Zend Framework 개체를 전달해서는 안됩니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다