php - PHP 会话在后台进程中不起作用
问题描述
我有这段代码,当支付网关成功时,它将重定向到参数中的通知 url。
include 'payment_information_rebill.php';
if(isset($_GET)){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'url here',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"merchantId": "' .$_mid. '",
"orgResponseId": "' .$_responseid. '",
"requestId": "' .$_requestid. '",
"amount": "' .$_verifamount. '",
"clientId": "' .$_clientid. '",
"clientIp": "' .$_clientip. '",
"ipAddress": "' .$_ipaddress. '",
"signature": "' .$_signverify. '"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Idempotency-Key: ' .$_requestid. '',
'Authorization: Basic auth here'
),
));
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true); // true turns it into an array
}
付款信息 rebill 包含 curl 所需的所有变量,可在购物车页面上使用。但是,当我将 curl 函数放在支付网关的 redirecturl 中时,变量似乎为空。变量从会话中获取数据。会话仅在您访问该页面时起作用吗?它不适用于背景吗?
解决方案
推荐阅读
- c# - AutoMapper InternalDbSet`1 -> IQueryable`1 异常
- php - 如何在页面中间使用 PHP 追加?
- linux - 在文件中搜索单词并将其从小写转换为大写
- llvm-clang - 开始使用 clang、LLVM 和运行现有通道
- sql-server - SQL Server 根据另一个表中的条件查找值的总和
- sql-server-2012 - 插入值 1000 行限制
- ios - NSURL _fastCStringContents:尝试从 iOS 应用程序内部打开时出现错误的链接 URL
- javascript - 通过使用会话避免多个 API 身份验证
- django - 如果收到消息,如何更改消息图标
- typescript - 来自可变类型数组的交集类型