我有页面作为结帐过程的一部分,它使用了出现此错误的 3rd 方 API:
警告:session_start() [function.session-start]:无法发送会话 cookie - 标头已由第 1 行 /upgrades/upgradevip.php 中的(输出开始于 /upgrades/upgradevip.php:1)发送
警告:session_start() [function.session-start]:无法发送会话缓存限制器 - 第 1 行 /upgrades/upgradevip.php 中的标头已发送(输出开始于 /upgrades/upgradevip.php:1)
我需要更改 php 代码中的哪一行才能使其正常工作?
这是代码:
<?php session_start();
include('./includes/config.php');
include('./includes/functions.php');
include('./lib/recurly.php');
$message='';
// Required for the API
Recurly_Client::$apiKey = API_KEY;
// Optional for Recurly.js:
Recurly_js::$privateKey = PRIVATE_KEY;
$acc=get_querystring_var_val('account');
$plan=get_querystring_var_val('plan');
$subid=get_querystring_var_val('subid');
$aff=get_querystring_var_val('aff');
$firstname=get_querystring_var_val('firstname');
$lastname=get_querystring_var_val('lastname');
$email=get_querystring_var_val('email');
$phonenumber=get_querystring_var_val('phonenumber');
$brand=get_querystring_var_val('brand');
$zip=get_querystring_var_val('zip');
if(isset($_POST['process']) && $_POST['process'] =='1'){
/*
* get all session info to process
*/
$selCardType=get_session_val('selCardType');
$txtCCNumber=get_session_val('txtCCNumber');
$txtSecurityCode=get_session_val('txtSecurityCode');
$selMonth=get_session_val('selMonth');
$selYear=get_session_val('selYear');
$account_code=$acc;
if($account_code!=''){
/*
* process transaction
*/
$transaction = new Recurly_Transaction();
$transaction->description = $upsell_description;
$transaction->amount_in_cents = $upsell_amount_in_cents;
$transaction->currency = CURRENCY_CODE;
$account = new Recurly_Account();
$account->account_code = $account_code;
$billing_info = new Recurly_BillingInfo();
$billing_info->first_name = $firstname;
$billing_info->last_name = $lastname;
$billing_info->number = $txtCCNumber;
$billing_info->verification_value = $txtSecurityCode;
$billing_info->month = $selMonth;
$billing_info->year = $selYear;
$billing_info->zip = $zip;
$account->billing_info = $billing_info;
$transaction->account = $account;
$success=false;
try{
$transaction->create();
$success=true;
}catch(Exception $e){
$message='There was problem processing your request.' . $e;
}
if($success){
/*
* set one time transaction details in session
*/
try {
$transactions = Recurly_TransactionList::getForAccount($account_code);
foreach ($transactions as $transaction) {
//print "$subscription\n";
//echo '<br/><br/>';
$_SESSION['onetime_receipt']=$transaction->uuid;
}
} catch (Recurly_NotFoundError $e) {
//$message= "Transaction not found" . $e;
}
header('Location: /congratulations2deff5-us.php?account='. $acc.'&plan=' . $plan.'&subid=' . $subid.'&aff='.$aff.'&firstname='.$firstname.'&lastname=' .$lastname. '&email=' .$email .'&phonenumber='.$phonenumber.'&brand=' . $brand . '&zip=' . $zip);
exit;
}else{
//ideally this is place to set a variable to show a form which asks a user to fill contact info and cc info agaian
$message='Transaction could not be processed';
}
}else{
$message='There was problem processing your request.';
}
}
?>