php - 将元素插入codeigniter中的数组

标签 php mysql arrays codeigniter

我是 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'];

关于php - 将元素插入codeigniter中的数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20659396/

相关文章:

php - 在 SQL 查询中计算时间

php - 为什么 Apache 支持 PHP、Perl、Python... 但不支持 Servlet?

php - 当 REDIS 想要过期时如何处理

php - 使用 php 进行多选选项 onChange

php - 我应该如何在 SQL 中存储不同类型的帖子? (PHP/MySQL)

c# - 如何: *. csv -->行-->someArray-->修改

mysql - SQL中分组行的平均值

mysql子查询限制也限制父查询

javascript - 数组在 Nodejs 和 MongoDB 中使用 forEach 循环返回空值

javascript - 如何根据对象中的属性对对象数组进行分组