1
$ this-> input-> post()を使用して、ビューページからポスト配列の送信を受けようとしています。しかし、CIはそれを行うことができないようです。何かご意見は?助けのためのcodeigniterはポスト配列を受け取ることができますか?
コントローラ
public function pub()
{
// the postArray is an array: $postArray['t1']=test1, $postArray['t2']=test2
$go=$this->input->post('postArray');
foreach ($go as $test){
echo $test['t1']; //show nothing
echo $test['t2']; //show nothing
}
//the following code would work if I sent the $postArray as a string variable
public function pub()
{
// the postArray is an string variable $postArray='test1'
$go=$this->input->post('postArray');
echo $go; //show test1
}
感謝。
UPDATE:私のビューページでjQueryのコード
//postArray is an array
$.post('<?=base_url()?>/project_detail/pub', {'postArray':postArray},function(go)
{
alert(go);
})
マイアップデートをご覧ください。 jquery .postを使用してデータを送信しています。私はそれが配列だと確信しています。 +1。 :D – FlyingCat
NVM私はそれを得た。ありがとうlolwut。 – FlyingCat