gpt4 book ai didi

php - 重定向时 codeigniter 中的网址更改

转载 作者:搜寻专家 更新时间:2023-10-31 20:35:24 24 4
gpt4 key购买 nike

我是 codeigniter 的新手。

我试图开发登录页面,它几乎完成了,但我不知道我什么时候尝试在成功登录后重定向页面或在登录不成功后重定向,url localhost:81 的起始部分> 更改为 [::1]。我不知道为什么会这样,我用谷歌搜索,但我没有找到正确的方法,所以请有人在下面帮助我,我已经提到了我的代码。

提前谢谢你。


这是验证邮箱和密码的 Controller 代码

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class verifyLogin_controller extends CI_Controller {

function _construct(){
parent::_construct();
}

public function index()
{

if($_POST["submitLogin"])
{
$userEmail=$this->input->post('email');
$password=$this->input->post('password');

$verify_query = $this->db->from("admin");
$verify_query = $this->db->where(array("admin_userid" => $userEmail,"admin_password"=>$password));
$verify_query = $this->db->limit(1);
$res=$this->db->get()->result();
if($res != null)
{

redirect("homeHeader_controller/index");

}
else
{

redirect("adminLogin_controller/index");

}

}
}
}

最佳答案

设置您的base_url:

$config['base_url'] = 'http://localhost:81/';

关于php - 重定向时 codeigniter 中的网址更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36857617/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com