Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在codeigniter中将元素推入阵列_Php_Mysql_Arrays_Codeigniter - Fatal编程技术网

Php 在codeigniter中将元素推入阵列

Php 在codeigniter中将元素推入阵列,php,mysql,arrays,codeigniter,Php,Mysql,Arrays,Codeigniter,我是codeigniter的新手,我拥有以下阵列: $data = array( 'username' => $this->input->post('uname'), 'fname' => $this->input->post('fname'), 'lname' => $this->input->post('lname'),

我是codeigniter的新手,我拥有以下阵列:

$data = array(
                'username' => $this->input->post('uname'),
                'fname' => $this->input->post('fname'),
                'lname' => $this->input->post('lname'),
                'phone' => $this->input->post('phone'),
                'email' => $this->input->post('email'),
                'password' => $this->input->post('pass'),
                'bdate' => $this->input->post('date'),
                'status' => $this->input->post('status')

            );
我想把下面的项目推进去

$data = array_push($data, 'userfile', $_FILES['userfile']['name']);
请把它改一下。 如何将元素推入数组。

只需执行此操作

$data['userfile']=$_FILES['userfile']['name'];
就这么做吧

$data['userfile']=$_FILES['userfile']['name'];

上述解决方案应该有效。您是否已检查是否正确获取了$\u文件数据?请尝试使用var\u dump($\u文件),并且在您的表单中包含此attr enctype=“multipart/form data”我想我必须使用array\u push()。但我不知道如何使用它??上述解决方案应该有效。您是否已检查是否正确获取了$\u文件数据?请尝试使用var\u dump($\u文件),并且在您的表单中包含此attr enctype=“multipart/form data”我想我必须使用array\u push()。但我不知道如何使用它???@ShankarDamodaran非常感谢much@ShankarDamodaran非常感谢你