【发布时间】:2014-05-23 07:38:55
【问题描述】:
我的重定向和服务器检查不适用于我在 codeigniter 中的 index.php。
我有一个用于 codeigniter 的前端安装向导,有 4 个步骤,第 4 步是最后一步。我正在努力做到这一点,如果用户已完成这些步骤并已达到第 4 步,则可以访问该域/服务器上的网站。
目前我使用的代码一直重定向到我的安装 URL 的 index.php,即使我已经完成了所有步骤。
下面这段代码在我的主要 index.php 上
if (!file_exists('install/index.php')) {
// Make sure we've not already tried this
if (strpos($_SERVER['REQUEST_URI'], '/install/')) {
header('Status: 404');
exit;
}
// Otherwise go to installer
header('Location: '.rtrim($_SERVER['REQUEST_URI'], '/').'/install/');
exit;
}
欢迎控制器
public function index()
{
if (!file_exists('install/index.php')) {
// Make sure we've not already tried this
if (strpos($_SERVER['REQUEST_URI'], '/install/')) {
header('Status: 404');
exit;
}
// Otherwise go to installer
header('Location: '.rtrim($_SERVER['REQUEST_URI'], '/').'/install/');
exit;
} else {
$this->load->view('welcome_message');
}
}
【问题讨论】:
标签: php codeigniter