我想知道如何使用MY模型进行回调验证 - 由Jamie Rumbelow制作,模块化扩展 - wiredesignz
我创建了MY_Form_validation并修改了运行函数,如下所示:
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);
}
如果我在控制器中使用回调运行表单验证,它可以正常工作,但我想知道如何在模型内部运行,它总是跳过回调
谢谢你的时间和答案:)