common.lib 메타태그를 이용한 URL이동 오류
본문
// 메타태그를 이용한 URL 이동
// header("location:URL") 을 대체
function goto_url($url)
{
$url = str_replace("&", "&", $url);
//echo "<script> location.replace('$url'); </script>";
if (!headers_sent())
header('Location: '.$url);
else {
echo '<script>';
echo 'location.replace("'.$url.'");';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
echo '</noscript>';
}
exit;
}
라는 내용인데....
Warning: Header may not contain more than a single header, new line detected in
...이라는 내용이 뜨더라구요 오류 항목은 header('Location: '.$url); 이쪽이었습니다
무엇이 문제일까요?
답변 4
php8에서 어런 에러 뜬다는건가요?
goto_url()사용한 파일 내용을 올려 보세요.
그냥 아래 부분을 삭제하는게 더 빠른 처리방법일것 같네요.
if (!headers_sent())
header('Location: '.$url);
else {
답변을 작성하시기 전에 로그인 해주세요.