Codeigniter中付款网关返回URL上的会话数据为空 [英] session data empty on the payment gateway return URL in Codeigniter

查看:73
本文介绍了Codeigniter中付款网关返回URL上的会话数据为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于这个问题有几个问题,我已经尝试了那里提出的大多数解决方案,但仍然无法弄清楚这个问题.我正在使用PayU付款API.成功付款后,会话数据在RETURN URL上为空.我在会话中只设置了一些字段,例如用户ID,购物车中的产品ID

There are several questions on this issue and I have tried most of the solutions suggested there, still I am unable to figure out the issue. I am using PayU payment API. Upon successful payment, the session data is empty on the RETURN URL. I had set only few fields in the session like user ID, product IDs in the cart

下面是返回URL函数:

Below is the return URL function:

public function payment_success() {
    echo "<pre>"; print_r($_SESSION);
    exit;
}

我看到的输出:

    Array
(
    [__ci_last_regenerate] => 1600755715
)

请注意,在从一个函数重定向到另一个函数时,会话数据仍然存在.问题仅出现在付款网关的返回URL功能上,该功能也位于同一控制器中

Note that the session data persists while redirecting from function to function. Issue is only on the payment gateway's return URL function which is also in the same controller

PHP版本:7.2.31Codeigniter版本:3.1.11

PHP Version:7.2.31 Codeigniter Version:3.1.11

//我的config.php:

//My config.php:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

我尝试过的可能性

//1
$config['sess_save_path'] = APPPATH.'ci_session/';

//2
$config['sess_expiration'] = 7200;

//3 in Session.php
// ini_set('session.name', $params['cookie_name']);
ini_set('session.id', $params['cookie_name']);

//4 tried under PHP versions 7.1 and 7.3

推荐答案

问题与"cookie SameSite属性"有关.Chrome 84版即将推出.感谢@ 04FS的提示.在.htaccess中添加以下行对我有用

The issue was about "cookie SameSite attribute". It is coming for Chrome version 84. Thanks to @04FS for the hint. Adding the below line in .htaccess worked for me

Header always edit Set-Cookie (.*) "$1; SameSite=None;Secure"

这篇关于Codeigniter中付款网关返回URL上的会话数据为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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