简体   繁体   English

扩展验证类fuelphp?

[英]Extending Validation Class fuelphp?

Fuelphp Extending Validation classes link Fuelphp扩展验证类链接
http://fuelphp.com/docs/classes/validation/validation.html#rules http://fuelphp.com/docs/classes/validation/validation.html#rules

Hi guys 嗨,大家好

I am facing a very critical problem for Extending Validation classes. 对于扩展验证类,我面临一个非常关键的问题。 Can anyone suggest a solution to me, and how the step is done, as well as how can perform it ???? 谁能为我提出解决方案,以及如何完成此步骤以及如何执行?

This is the way I done it 这就是我做到的方式

Screenshot of Image 1 图片1的屏幕截图

I try to add class at path(fuel/app/myrules) with below class 我尝试在以下课程的路径(fuel / app / myrules)上添加课程

<?php
class MyRules
{
    // note this is a non-static method
    public function _validation_is_upper($val)
    {
    return $val === strtoupper($val);
    }

}
?>

Image 2 图片2

Next at the controller, adding this for call 接下来在控制器上,将其添加为通话

  $val = Validation::forge();
  $val->add_model('_validation_is_upper');

but nothing happens. 但什么也没发生。

The fuelphp document is incomplete. fuelphp文档不完整。

$val = Validation::forge();
$val->add_callable(new MyRules());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM