当我想在fuelphp中使用GET方法进行验证时,我遇到了问题
中查找// run validation on just post
if ($val->run())
{
// process your stuff when validation succeeds
}
else
{
// validation failed
}
该代码仅验证该方法是Post还是默认发布。
如何验证方法get?
答案 0 :(得分:0)
针对数组运行验证:
if ($val->run( array( $validation_rule => $value_to_validate) ))
{
// process your stuff when validation succeeds
}
else
{
// validation failed
}
示例:
$val = Validation::factory();
$val->add('email')->add_rule('valid_email');
if ($val->run( array('email'=>$email) ))
{
// $email is valid
}
else
{
// $email is not valid
}