如何在CodeIgniter中将动态基本URL设置为https? [英] How to set Dynamic base url to https in CodeIgniter?

查看:166
本文介绍了如何在CodeIgniter中将动态基本URL设置为https?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在这篇文章中使用动态基本网址:

I try the use a dynamic base url in this post:

在CodeIgniter中设置动态基本URL

但我以前是使用http,但现在,我想改为https,我该怎么办?感谢。

But I used to be use the http, but now, I would like to change to https, how can I do so? Thanks.

推荐答案

在您的config / config.php中,尝试:

In your config/config.php, try this:

$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;

这篇关于如何在CodeIgniter中将动态基本URL设置为https?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆