Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我现在正在开发一个 PHP 页面,但我遇到了一个问题。如何使用 PHP 重新加载带有获取参数的网页?例如:
www.example.com/page.php
这是之前的页面。
www.example.com/page.php?view=list
这是后面的页面。
通过以下方式执行重定向header:
header
http://php.net/manual/en/function.header.php
在 page.php 的顶部
<?php if(!isset($_GET['view'])){ header('Location: page.php?view=list'); exit; } ?>
如果尚未设置,这将使用所需的 GET 参数集重新加载页面。
通常,尽管您只需使用文本中已设置的 GET 参数创建 HREF 链接...