<form> <input type="checkBox" name="item[]" value="1" /> <input type="checkBox" name="item[]" value="2" /> <input type="checkBox" name="item[]" value="3" /> </form> <?PHP $app = JFactory::getApplication(); $items = $_POST['type']; // This works but is not Joomla wise... $items = $app->input->getArray(array('type_ids')); // Tried multiple ways but can't get it to work. ?>
将所有表单项加载到数组$items中的正确方法是什么?
解决方法
对于使用legacy的组件,以下代码有效(版本3.3):
$jinput = JFactory::getApplication()->input; $data2 = $jinput->post->getArray(array()); var_dump($data2);