我有一個關於PHP錯誤的問題。我經歷了其他類似的問題,並應用它,但我仍然有這樣的問題,所以我問了這個問題。警告:標題可能不包含多個標題,檢測到新行
情況就是這樣。有一個文本框稱爲特殊指令;如果我只放一條線就可以工作,但如果我放了多條線,就會導致這樣的問題。我把urlencode(str)解決了這個問題,但它仍然出現。我需要改變什麼? T.T
錯誤消息是「警告:標題可能不包含多個標題,檢測到新行。」
if($_POST['Submit'] == 'Submit Order'){
$today = date('D M dY');
$to_time = date('h:i a');
$hours = substr($to_time, 0, -6);
$minutes = substr($to_time, -5, 2);
$seconds = substr($to_time, -2);
$total_seconds = ($hours * 3600) + ($minutes * 60) + $seconds;
$date123 = $_POST['day'];
$date_post = date('D M dY',$date123);
$time_post = $_POST['time'];
$hours_post = substr($time_post, 0, -6);
$minutes_post = substr($time_post, -5, 2);
$seconds_post = substr($time_post, -2);
$total_seconds_post = ($hours_post * 3600) + ($minutes_post * 60) + $seconds_post;
$tip_amo = $_POST["tip_amount"];
$deliv_mails = $_POST["deliv_mails"];
$coupon_no = $_POST['coupon_no'];
$minorder = $_POST['minorder'];
$subtotal_amount = $_POST['subtotal_amount'];
$payment_type = $_POST['payment_type'];
$comments = addslashes($_POST['comments']);
$coupon_code = $_REQUEST["coupon_code"];
$customer_comments = get_field(CART,"additional_text","session_id='$sessionid'");
if($comments == ''){
$comments1 = $customer_comments;
}else{
$comments1 = $comments;
}
if($time_post!='') {
if($today==$date_post){
$query = [
'day' => $date123,
'time' => $time_post,
'coupon_no' => $coupon_no,
'minorder' => $minorder,
'subtotal_amount' => $subtotal_amount,
'payment_type' => $payment_type,
'comments' => $comments1,
'coupon_code' => $coupon_code,
'tip_amount' => $tip_amo,
'deliv_mails' => $deliv_mails,
'd' => $address
];
header('Location: details_info_order.php?' . http_build_query($query));
exit;
}else{
$query = [
'day' => $date123,
'time' => $time_post,
'coupon_no' => $coupon_no,
'minorder' => $minorder,
'subtotal_amount' => $subtotal_amount,
'payment_type' => $payment_type,
'comments' => $comments1,
'coupon_code' => $coupon_code,
'tip_amount' => $tip_amo,
'deliv_mails' => $deliv_mails,
'd' => $address
];
header('Location: details_info_order.php?' . http_build_query($query));
exit;
}
}
}
警告:報頭可能不包含超過一個頭以上,新行檢測。在線64上的/home4/mikehan2/public_html/mikehan7/final_checkout_block.php
這是確切的錯誤消息。
您是否爲SO格式化了代碼?該文本必須在一個單一的醜陋的長行(不能使用換行符來提高標題中的可讀性)。 – bansi
哈哈...我知道它是在一個醜陋的單行... –
你不能在這樣的字符串中使用'urlencode()' – Phil