Codeigniter https网站上的页面

时间:2014-03-14 11:06:11

标签: php codeigniter paypal

我在Codeigniter建立了一个定制网站,我的客户通过PayPal获得订单。

正在发生的问题是我编写了网站,以便在PayPal订单完成且返回返回网站时,预订会更新为付款。

我注意到有些订单,客户没有返回网站,因为有时候"不安全的数据"你可以在大多数浏览器中使用弹出窗口。

我认为,解决此问题的方法是将返回页面设为https:// page。

所以我想知道如何将CI中的配置更改为仅在该页面上的https://链接。

可能还有其他方式,我愿意接受建议。

我也在考虑更新订单的IPN路线,但不太确定那个。

由于

2 个答案:

答案 0 :(得分:3)

使用MY_url_helper助手。 将以下代码添加到帮助程序中,并在您强制使用ssl时使用它。

<?php

function ssl_support() {
    $CI = & get_instance();
    return $CI->config->item('ssl_support');
}

if (!function_exists('force_ssl')) {

    function force_ssl() {
        if (ssl_support() && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')) {
            $CI = & get_instance();
            $CI->config->config['base_url'] = str_replace('http://', 'https://', $CI->config->config['base_url']);
            redirect($CI->uri->uri_string());
        }
    }

}

if (!function_exists('remove_ssl')) {

    function remove_ssl() {
        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
            $CI = & get_instance();
            $CI->config->config['base_url'] = str_replace('https://', 'http://', $CI->config->config['base_url']);

            redirect($CI->uri->uri_string());
        }
    }

}
}

答案 1 :(得分:1)

我会说将所有内容放在一个文件夹中并使用SSL进行操作?

application / config / config.php,设置基本网址:

$config['base_url'] = "https://www.yoursite.com/";
相关问题