php - 无法在 codeigniter 中保留 post 变量
问题描述
如果用户单击提交按钮,我已经在 codeigniter 中创建了一个表单,他将被重定向到用户个人资料页面。但在我的情况下,用户被重定向到个人资料页面,但是当我重新加载个人资料页面时,我从以前的表单中发布的所有数据,即用户 ID 和名称都是空白的。
这是我的代码:
public function Profile() {
$uId = decode($this->input->post('_id'));
$name = decode($this->input->post('_name'));
$this->data['ID'] = encode($uId);
$this->data['contents'] = $this->load->view('web/profile', $this->data, true);
$this->load->view('web/layout', $this->data);
}
解决方案
UserID
将and存储name
在会话变量中可以解决您的问题。加载后只需销毁使用的会话变量。
推荐阅读
- python - python asyncio.gather vs asyncio.as_completed 当 IO 任务后跟 CPU-bound 任务时
- android - 在授予 MANGED_EXTERNAL_STORAGE 的情况下,Android 11 上的 EACCES 权限被拒绝
- java - Java Springboot——编辑一个用户——mongodb不写条件逻辑
- javascript - 如何使用 Javascript 一次只有一个 aria-selected="true" 而其余的为 "false"?
- sql - 如何删除 SQLite 中过期的记录
- node.js - 应该如何为具有不同字段的几个猫鼬模型创建模式?
- php - 在 foreach 循环中为 WP 标签回显 ACF 颜色选择器值
- typescript - 当有多个泛型时,从调用站点的值推断函数 arg 中的类型失败
- mysql - 获取最近7天有交易的用户,30天内只有一笔交易
- bigbluebutton - BigBlueButton 2-3-dev html5client 显示“404 未找到”