【发布时间】:2015-03-30 20:20:13
【问题描述】:
很容易将数据从控制器传递到视图。此外,要将数据从视图传递到控制器,您需要表单标签。但是,如何从输入表单传递数组?有什么想法吗?这是数组的样子:
$test = array
(
array($employee_id[0],$name[0],$days_worked[0],$overtime_hours[0]),
array($employee_id[1],$name[1],$days_worked[1],$overtime_hours[1]),
array($employee_id[2],$name[2],$days_worked[2],$overtime_hours[2])
);
从我的 html 视图中,我得到了一个输入表单:
<input name="test" type="text" class="form-control" id="test" value="<?php echo $test;?>">
当我使用我的模型测试它是否在数组中获取数据时:
$this->test = $_POST['test'];
echo $test = $_POST['test'];
我得到的只是一个字符串“数组”。我无法访问数组中的内容。我需要帮助。
【问题讨论】:
标签: php arrays parameter-passing