PHP网站页面跳转的方式

header('Location: https://www.maosiji.com/');
exit;

注意:

  • header 执行前不能有任何输出
  • location“:” 号间不能有空格,否则不会跳转
  • header 后的 PHP 代码还会执行,所以需要注意使用 exit;