第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

我如何在 CodeIgniter 3 中正確重定向?

我如何在 CodeIgniter 3 中正確重定向?

PHP
慕仙森 2023-04-15 10:34:12
我是 codeigniter 的新手,我正在開發(fā)一個(gè)帶有會(huì)話的基本身份驗(yàn)證系統(tǒng)。我正在使用版本3.1.11請(qǐng)注意,我正在我的本地主機(jī)服務(wù)器上進(jìn)行開發(fā)。項(xiàng)目網(wǎng)址: http://localhost/tutorial/codeigniter登錄網(wǎng)址: http://localhost/tutorial/codeigniter/login/index.php/auth/login用戶個(gè)人資料網(wǎng)址: http://localhost/tutorial/codeigniter/login/index.php/user/profile另外,我的登錄代碼有效。控制器:Auth.phppublic function __construct(){  parent::__construct();  $this->load->database();  $this->load->helper('url');}public function login(){  $this->form_validation->set_rules("username", "Username", "required");  $this->form_validation->set_rules("password", "Password", "required|min_length[7]");  if($this->form_validation->run() == TRUE) {    ....    if ($row) {      $this->session->set_flashdata("success", "Success!!!");       $_SESSION["user_logged"] = TRUE;      $_SESSION["username"] = $user->username;      // redirect to profile page      redirect('user/profile', 'refresh');    } else {      $data['error']="<div class='alert alert-danger'>Invalid login details</div>";    }  }  $this->load->view("login", @$data);}控制器:User.phpclass User extends CI_Controller{  public function profile()  {    echo "Profile Page";  }}問題:我想在用戶成功登錄后將用戶重定向到http://localhost/tutorial/codeigniter/login/index.php/user/profile 。我用于重定向的代碼是redirect('user/profile', 'refresh');上面重定向代碼的問題在于,它被重定向到http://localhost/tutorial/login/index.php/user/profile -- The /codeigniteris not included您知道如何正確重定向到http://localhost/tutorial/codeigniter/login/index.php/user/profile嗎?任何幫助是極大的贊賞。謝謝
查看完整描述

2 回答

?
九州編程

TA貢獻(xiàn)1785條經(jīng)驗(yàn) 獲得超4個(gè)贊

請(qǐng)將base_url下方設(shè)置application/config/config.php為 http://localhost/tutorial/codeigniter。這將幫助您修復(fù)錯(cuò)誤。

謝謝


查看完整回答
反對(duì) 回復(fù) 2023-04-15
?
qq_花開花謝_0

TA貢獻(xiàn)1835條經(jīng)驗(yàn) 獲得超7個(gè)贊

您應(yīng)該在 application/config 下的 config.php 中設(shè)置。打開 config.php 并放在下面一行。

$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/tutorial/codeigniter/';


查看完整回答
反對(duì) 回復(fù) 2023-04-15
  • 2 回答
  • 0 關(guān)注
  • 143 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)