print_r($this->input->post()) を実行すると、配列が出力され、その後に 1 が表示される理由が非常に気になります。これはそれが印刷するものです:
Array ( [username] => lilmousiee [birthdate] => 1992-04-26 [gender] => 1 [password] => 66lah66lab [password2] => 66lah66lab [pin] => 2323 [pin2] => 2323 [email] => mouseywings@live.com [email2] => mouseywings@live.com [region] => 1 [dtype] => air [dname] => Mattyco [dgender] => 1 [terms] => [recaptcha_challenge_field] => 03AHJ_VutHNI6hK3M_trpE-n4Qr9V5wWSH10p8hmQjrYVLeWf65ylIDva5XdH78uGED5KCsMx8tp3FHZ6p1xTllyrdSP7nEbnSILQ9CDqrxoD2pit5o9T9Cowy06_O6XLLM22fvH_5ICqoYrmI-o-P8dGCal0fNKuSohgvFU03FmgbhuYTDjJ_xUA [recaptcha_response_field] => asdfsadf [submit] => Register [search] => [type] => usersitems ) 1
配列の後に「1」が表示されるのはなぜですか? 入力したものさえありません...そして、登録ボタンの後に値1を実行する入力フィールドはありません...そして、「検索」キーと「タイプ」キーとは正確には何ですか?
私のHTMLの最後の部分:
<legend>Terms of Use</legend>
<div id="terms">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vitae turpis ut sem tristique luctus. Sed tincidunt consequat tristique. Mauris laoreet vestibulum aliquam. Ut enim tortor, aliquet at faucibus sed, venenatis eget tellus. Praesent velit nisl, bibendum a dignissim nec, hendrerit non lacus. Fusce dapibus pharetra molestie. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vitae turpis ut sem tristique luctus. Sed tincidunt consequat tristique. Mauris laoreet vestibulum aliquam. Ut enim tortor, aliquet at faucibus sed, venenatis eget tellus. Praesent velit nisl, bibendum a dignissim nec, hendrerit non lacus. Fusce dapibus pharetra molestie. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vitae turpis ut sem tristique luctus. Sed tincidunt consequat tristique. Mauris laoreet vestibulum aliquam. Ut enim tortor, aliquet at faucibus sed, venenatis eget tellus. Praesent velit nisl, bibendum a dignissim nec, hendrerit non lacus. Fusce dapibus pharetra molestie. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vitae turpis ut sem tristique luctus. Sed tincidunt consequat tristique. Mauris laoreet vestibulum aliquam. Ut enim tortor, aliquet at faucibus sed, venenatis eget tellus. Praesent velit nisl, bibendum a dignissim nec, hendrerit non lacus. Fusce dapibus pharetra molestie. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
</div>
<?php echo form_checkbox(array('name' => 'terms')); ?> Accept Terms of Use
<div class="row clearfix">
<?php
echo recaptcha_get_html($public_key);
?>
</div>
</fieldset>
<?php echo print_r($array); ?>
<div class="row clearfix"><?php echo form_submit('submit', 'Register'); ?></div>
<? echo form_close(); ?>
$this->input->post() 配列を検証関数に渡すのに問題があります。ここに私のライブラリフォルダの MY_Form_validation.php があります:
class MY_Form_validation extends CI_Form_validation {
private $post;
public function __construct($params = array()) {
foreach($params as $param) {
parent::__construct($param['config']);
$this->post = $param['post'];
}
}
}
「1」が $this->post 値として出力されている理由はありますか?配列のキーと値を保持する必要があるのはいつですか? これは私がパラメータを渡す方法です:
$this->load->library('MY_Form_validation', array('config' => '', 'post' => $this->input->post()));
しかし、print_r($this->post) を入れると、「1」しか出力されません..