有一段時間了一個真正的問題,並且無法弄清楚。 基本上下面的代碼是一個功能的一部分,我檢查,沒有輸出打印到瀏覽器:該功能的與頭重定向問題的協助
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發送的。你檢查了嗎?也許有一個結束標記「?>」和一些換行符或那裏的東西。如果是這樣,刪除標籤,這是不需要的。 –