一段时间以来,确实存在一个非常棘手的问题,但无法解决。基本上下面的代码是函数的一部分,我检查并没有输出打印到浏览器:
case 'Failed': // if it fails...
switch ( $unencrypted_values['Status'] ) {
case 'NOTAUTHED':
case 'REJECTED':
case 'MALFORMED':
case 'INVALID':
case 'ABORT':
case 'ERROR':
$purchase_log = new WPSC_Purchase_Log( $unencrypted_values['VendorTxCode'], 'sessionid' );
$purchase_log->set( array(
'processed' => WPSC_Purchase_Log::INCOMPLETE_SALE,
'notes' => 'SagePay Status: ' . $unencrypted_values['Status'],
) );
$purchase_log->save();
// if it fails redirect to the shopping cart page with the error
// redirect to checkout page with an error
$error_messages = wpsc_get_customer_meta( 'checkout_misc_error_messages' );
if ( ! is_array( $error_messages ) )
$error_messages = array();
$error_messages[] = '<strong style="color:red">' . $unencrypted_values['StatusDetail'] . ' </strong>';
wpsc_update_customer_meta( 'checkout_misc_error_messages', $error_messages );
$checkout_page_url = get_option( 'shopping_cart_url' );
if ( $checkout_page_url ) {
header('Location: '.$checkout_page_url );
exit();
}
break;
}
break;
那是功能的一部分,但是当我运行我的脚本时,我收到错误消息:
Warning: Cannot modify header information - headers already sent by (output started at /home/******/public_html/wp-content/themes/reallywildflowers/header.php:13) in /home/reallyw/public_html/wp-content/plugins/myplugin/merchants/sagepay.php on line 598 - See more at: http://website.com/products-page/transaction-results/?crypt=NzsPDC0yayoLATltUScRGBA6HTw9NTcCJXMqezgmMVkJKh0LOSYzSy4rBVwFFREcAG8MAXgSPwY8IgpNGAZDLwEhChcqFS4oJioOBEZFUkhXd15Ab3ZiX31oPWkkIB0wAHIVT2B3YCl8d1sUQURXSUl7LzpgbBdTDwpGCkA1XUAlCVtObnBlFm8PBlYCGhFEUHxATX4AADgKGFkENjgpWSkOOjsQZxcPLTwOSgQmAAoRIxpFFQACKAELLx8nGxYNJyAKHQokJR4lOlZ0NiAmMSELSDsOcwQOOjsHTUo5JC0nBys8fgY/DT0PAl1KRENKIBwLGy0zMzg9Lx9MBEkqMkIMLy4OfBslHhg8ekM8LTUtfyc6GXBmPR15L3pRNwQLABsXCD18ACIaD011FgcRTSAmCREsMmtcfX5Z
第 598 行是代码中的这一行:
header('Location: '.$checkout_page_url );