我正在用 oops 进行编码以在 PHP 中上传图像。但是提交图像后,它会发出警告
“标题可能不包含多个标题,检测到新行”
下面是我的函数,它给出的错误
public function ft_redirect($query = '') {
if (REQUEST_URI) {
$_SERVER['REQUEST_URI'] = REQUEST_URI;
}
$protocol = 'http://';
if (HTTPS) {
$protocol = 'https://';
}
if (isset($_SERVER['REQUEST_URI'])) {
if (stristr($_SERVER["REQUEST_URI"], "?")) {
$requesturi = substr($_SERVER["REQUEST_URI"], 0, strpos($_SERVER["REQUEST_URI"], "?"));
$location = "Location: {$protocol}{$_SERVER["HTTP_HOST"]}{$requesturi}";
} else {
$requesturi = $_SERVER["REQUEST_URI"];
$location = "Location: {$protocol}{$_SERVER["HTTP_HOST"]}{$requesturi}";
}
} else {
$location = "Location: {$protocol}{$_SERVER["HTTP_HOST"]}{$_SERVER['PHP_SELF']}";
}
if (!empty($query)) {
$location .= "?{$query}";
}
header($location);
exit;
}