0

我想知道如何使用 MY 模型使用回调验证 - 由 Jamie Rumbelow 制作,带有模块化扩展 - wiredesignz

我已经创建了 MY_Form_validation 并修改了 run 函数,如下所示:

class MY_Form_validation extends CI_Form_validation {

/**
 * Stores the CodeIgniter core object.
 *
 * @access public
 *
 * @var object
 */
public $CI;



/**
 * Constructor
 *
 * @return void
 */
function __construct($config = array())
{
    // Merged super-global $_FILES to $_POST to allow for better file validation inside of Form_validation library
    $_POST = (isset($_FILES) && is_array($_FILES) && count($_FILES) > 0) ? array_merge($_POST,$_FILES) : $_POST;

    parent::__construct($config);

}
/**
 * Performs the actual form validation
 *
 * @access public
 *
 * @param string $module Name of the module
 * @param string $group  Name of the group array containing the rules
 *
 * @return bool Success or Failure
 */
public function run($module='', $group='')
{
    (is_object($module)) AND $this->CI =& $module;
    return parent::run($group);

}

如果我在控制器中使用回调运行表单验证,它会完美运行,但我想知道如何在模型中运行,它总是跳过回调

谢谢你的时间,你的回答:)

4

0 回答 0