0
我有一個Zend Form驗證器的奇怪問題。當我想輸出我看到的錯誤消息:ArrayArray。
我的代碼:
<?php
// Load sms request form
$smsRequestForm = new Application_Form_Sms_Request();
// Form posted?
if ($this->getRequest()->getMethod() != 'POST') {
// Show the form
$this->view->showForm = true;
$this->view->smsRequestForm = $smsRequestForm;
} elseif (!$smsRequestForm->isValid($_POST)) {
// Show the form and output the validation errors
$this->view->showForm = true;
$this->view->smsRequestForm = $smsRequestForm;
// Loop through the error messages
foreach($smsRequestForm->getMessages() as $message)
{
echo $message;
}
} else {
}
我已經閱讀文檔,得知回聲$消息;應以純文本形式輸出錯誤消息。
做foreach($ smsRequestForm-> getMessages()爲$ key => $ message);並沒有解決我的問題。
有誰知道我在做什麼錯?
在此先感謝!