php - Codeigniter 登录(会话)问题
问题描述
我的网站托管在 PHP 版本(5.6)的 VPS 服务器上。我面临登录问题。如果我清除浏览器缓存,那么我可以登录。问题是由于会话值为空,会话将我重定向回登录页面。我的会话值存储在数据库中。我的登录控制器代码如下。
if ($this->input->post()) {
// echo '<br>hiii';
$username = trim($this->input->post('user_id'));
$password = trim($this->input->post('password'));
$where = "(mobile_number = '".$username."' OR email = '".$username."') AND password = '".$password."' AND deactive='0'";
$where = "(mobile_number = '".$username."' OR email = '".$username."' AND deactive='0')";
$where_or = array('password' => $password);
$result = $this->mdgeneraldml->select('*', 'tbl_user', $where, '', '', '', '', '', '', '', '', '', '', $where_or);
if (count($result) > 0) {
if ($result[0]['profile_pic'] != '') {
$profile_img = base_url() . 'img/users/' . $result[0]['profile_pic'];
} else {
$profile_img = base_url() . 'img/default_user.png';
}
}
}
会话库在 config/autoload.php 中加载
$autoload['libraries'] = array('database','session', 'email');
解决方案
请检查您的codeigniter版本,如果是最旧的版本,请尝试将系统目录替换为您的项目系统目录,它将解决问题
推荐阅读
- sql-server - 使用 PySpark 执行 SQL DDL 语句(带约束)
- android - 在 RecyclerView.OnScrollListener 中设置视图可见性时的性能
- r - -3.39999999999999996e+38 NODATA 值和栅格 R
- c++ - OpenGL中一个对象上的两个图像
- php - 没有布局的 Zend 框架 ajax 请求
- flutter - Flutter Web - 无法编译应用程序
- python - 编写使用带有均值或直接相乘的 pandas Dataframe 计算加权平均值的方法
- json - 如何从 Powershell 中的 XML 文件中的元素中提取和解析属性
- javascript - 尝试使用 Ajax 删除文件
- azure - 在 azure Devops 中从运行时传递参数时,Yaml 编译变量不起作用