在主index.php
文件中,如果用户使用手机,我将重定向用户。但是在发送Location
标头之后,HTML 的其余部分也将不必要地发送给用户。有没有办法防止这种情况并跳过发送正常的 HTML?
代码如下所示:
<?php
if(preg_match(...)){
header('Location: http://m.mysite.com/');
}
?>
<html>
...normal version of the website...
</html>
在主index.php
文件中,如果用户使用手机,我将重定向用户。但是在发送Location
标头之后,HTML 的其余部分也将不必要地发送给用户。有没有办法防止这种情况并跳过发送正常的 HTML?
代码如下所示:
<?php
if(preg_match(...)){
header('Location: http://m.mysite.com/');
}
?>
<html>
...normal version of the website...
</html>