在Codeigniter中,如何将第三个参数传递给回调(表单验证)? [英] In Codeigniter, how to pass a third parameter to a callback (form validation)?

查看:105
本文介绍了在Codeigniter中,如何将第三个参数传递给回调(表单验证)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Form Validation类(在Codeigniter上)并设置规则.

I am currently using the Form Validation class (on Codeigniter) and setting rules.

它通过两个参数( codeigniter.com/user_guide/libraries/form_validation.html ):

$this->form_validation->set_rules('username', 'Username', 'callback_test[abc]');

但是第三个参数呢?还有第四...?有可能吗?

But what about a third parameter? And a fourth...? Is it possible?

推荐答案

它不是官方的,但是有效

It is not official but works

以','分隔参数

$this->form_validation->set_rules('article_big_image','Gambar Besar','callback_check_picture[article_big_image,edit]');

function check_picture($image,$param){
    $param = preg_split('/,/', $param);
    $field = $param[0];
    $action = $param[1];
    echo $field.$action;
}

这篇关于在Codeigniter中,如何将第三个参数传递给回调(表单验证)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆