1
私はクレジットカードのバリデーターを見つけました。しかし、私はコールバックでそれを使う方法がわかりません。使用したい機能には4つの入力が必要です。しかし、私はフォームのバリデーションを通してただ一つしか渡すことができません。誰かが私にこれを助けることを願っています。コールバック関数にちなんで命名する必要がCodeigniterクレジットカードヘルパーの使い方
コントローラ
public function next(){
$this->form_validation->set_error_delimiters('<p class="error">', '</p>');
$this->form_validation->set_rules('inputcardtype','Select Card Type','required|callback_check_default');
$this->form_validation->set_message('check_default', 'Please select the month of expiration');
$this->form_validation->set_rules('inputcardnumber', 'Card Number', 'trim|required|xss_clean|callback_cardnumber_validation');
$this->form_validation->set_rules('inputexpirationdatemonth','Select Month','required|callback_check_default');
$this->form_validation->set_message('check_default', 'Please select the month of expiration');
$this->form_validation->set_rules('inputexpirationdateyear','Select Year','required|callback_check_default');
$this->form_validation->set_message('check_default', 'Please select the year of expiration');
$this->form_validation->set_rules('inputnameoncard', 'Name on Card', 'trim|required|xss_clean');
$inputcardnumber = $this->input->post('inputcardnumber');
$inputcardtype = $this->input->post('inputcardtype');
if($this->form_validation->run()==false){
$this->index();
}else{
}
}
function cardnumber_validation($string = NULL) {
$this->load->helper('creditcardvalidation');
if(checkCreditCard ($string, $cardtype, $ccerror, $ccerrortext)) {
return TRUE;
}
else{
$this->form_validation->set_message("cardnumber_validation", 'The %s is not valid.');
return FALSE;
}
}
大変申し訳ございません。私は指定しなかった!私はcardnumber_validationのコールバックが欲しい – JianYA