带有foreach循环codeigniter的数组

时间:2016-06-20 12:51:41

标签: php arrays codeigniter

尝试使用上述格式排列数组中的值:

 $fields = array(
    'first_name' => array(
              'type' => 'varchar',
               'constraint' => 100,
     ),
     'last_name' => array(
             'type' => 'varchar',
               'constraint' => 100
      ),
      'street_address' => array(
               'type' => 'varchar',
               'constraint' => 200
   ),
 );

我的代码出错:

$fields = array(
  foreach ($this->input->post('fields') as $selectedOption){

                echo $str= $selectedOption."\n";
                $this->load->model('custom_field', '', TRUE);   
                $recordDetails = $this->custom_field->getRecordDetails($str);
                $result = json_decode(json_encode($recordDetails[0]), true);
                 $result['columnName'] = array(
                      'type' => $result['fieldType'],
                       'constraint' => $result['fieldLimit']
                    ),
             }
 );

如果有人可以提供帮助而不是请! 提前致谢

1 个答案:

答案 0 :(得分:0)

这是你想要完成的事情:

--rpcapi "personal,eth,web3"