我正在使用Kohana的验证方法来确定表单中存在某些强制值。在验证confirm_password ORM_Validation_Exception的“错误”的方法在下面的格式返回数组kohana - 如何从文件中获取_external错误消息
array(1) (
"_external" => array(1) (
"password_confirm" => string(45) "password confirm must be the same as password"
)
)
我怎样才能使它遵循相同的约定在错误的休息,这样我可以做以下的,只是通过遍历视图文件中的错误。
$Errors = $e->errors('user'); // inside the controller
<?php if ($Errors): ?>
<p class="message">Some errors were encountered, please check the details you entered.</p>
<ul class="errors">
<?php
echo Debug::vars($Errors);
foreach ($Errors as $message): ?>
<li><?php echo $message ?></li>
<?php endforeach ?>
<?php endif;
我曾尝试加入下消息的_external文件(也试过把它放在/消息/模型)文件夹,但它似乎没有工作。我应该呼叫$Errors = $e->errors('_external')
加载错误消息,在这种情况下,我怎么能加载包含其余错误消息的'用户'文件中的消息?