【发布时间】:2012-01-31 04:20:00
【问题描述】:
我正在尝试使用 $this->input->post() 接收从视图页面发送的帖子数组。但是,似乎 CI 无法做到这一点。有什么想法吗?
控制器
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
}
感谢您的帮助。
更新: 以下是我查看页面中的Jquery代码
//postArray is an array
$.post('<?=base_url()?>/project_detail/pub', {'postArray':postArray},function(go)
{
alert(go);
})
【问题讨论】:
标签: arrays codeigniter post