我有一個PHP腳本來做一些驗證,如果驗證關閉,它應該返回404。但它沒有。腳本沒有返回404
下面是腳本的開頭:
<?php
include '../connect.php';
include '../global.php';
include '../utils/api/problems.php';
include '../utils/api/suggested_solutions.php';
include '../utils/api/attempted_solutions.php';
include '../utils/api/categories.php';
$problem_id = mysql_real_escape_string($_GET["problem_id"]);
// Get member_id from session
$member_id = $_SESSION['user_id'];
// Validate the call
if (empty ($problem_id) || !isset ($problem_id) || !is_numeric ($problem_id))
{
$referer = $_SERVER['HTTP_REFERER'];
// Send me an email with the error:
$from = "from: [email protected]";
$to_email_address = 'my_email';
$error_subject = 'Error happened when getting problem_id from request';
$contents = 'Error in problem.php - here is the referer: '.$referer;
//mail($to_email_address, $error_subject, $contents, $from);
error_log (".......error validating problem id in problem.php");
header('HTTP/1.1 404 Not Found');
}
但出於某種原因,這並不返回404 - 任何想法,爲什麼?
謝謝!
什麼** **並使其返回?一個空白頁面的任何機會? – ManseUK 2012-01-04 17:33:42
你打開了display_errors嗎?你不知道有關已經發送的頭文件的錯誤嗎? – Hossein 2012-01-04 17:37:31