PHP

php跳转页面代码怎么写

小亿
94
2024-01-27 21:15:52
栏目: 编程语言

在PHP中,可以使用header()函数进行页面跳转。以下是一些常见的页面跳转示例代码:

  1. 跳转到指定URL:
header("Location: http://www.example.com");
exit;
  1. 跳转到当前目录下的另一个页面:
header("Location: another_page.php");
exit;
  1. 延迟跳转到指定URL,等待一定时间后跳转:
header("Refresh: 5; URL=http://www.example.com");
exit;

上述代码中的5表示等待5秒后跳转。

注意事项:

0
看了该问题的人还看了