當我使用 header('Location: index') 時,我得到“l(fā)ocalhost/pos/index”,當我使用 redirect('index') 時,我得到“l(fā)ocalhost/pos/localhost/pos/index”。我在 Windows 10 上使用 XAMPP?!發(fā)ocalhost/pos”是我的應(yīng)用程序的根。我嘗試使用“刷新”和“位置”無濟于事。我嘗試將控制器添加到 URI(因此使用 redirect('main/index') 代替),我在 URI 的開頭嘗試了一個斜杠 - 每次,redirect() 都以我之前指出的這種奇怪的方式工作。當我嘗試從 redirect() 主體復制 header() 代碼時,它實際上按預期工作...redirect('index'); // Does the weird repeated URLheader('Location: index'); // Works fineheader('Location: '.$uri, TRUE, $code); // Works fine, even though it's redirect()'s body when $metod == 'location'重定向('索引'):預期:http://localhost/pos/index結(jié)果:http://localhost/pos/localhost/pos/index
1 回答

慕碼人2483693
TA貢獻1860條經(jīng)驗 獲得超9個贊
設(shè)置你的base_url
in config.php
,我猜你的項目名稱pos
應(yīng)該是這樣的:
$config['base_url'] = 'http://localhost/pos/';
- 1 回答
- 0 關(guān)注
- 307 瀏覽
添加回答
舉報
0/150
提交
取消