有一段时间了一个真正的问题,并且无法弄清楚。 基本上下面的代码是一个功能的一部分,我检查,没有输出打印到浏览器:该功能的与头重定向问题的协助
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);
*我检查,没有输出打印到浏览器* - 再次检查 - 也许有一个空白之前,你的第一个PHP标签? – 1615903
我检查并重新检查它..没有什么打印到浏览器..无空格。 – misulicus
它说输出是由第13行的header.php发送的。你检查了吗?也许有一个结束标记“?>”和一些换行符或那里的东西。如果是这样,删除标签,这是不需要的。 –