[英]How to redirect from a link to another?
如果我在这个链接website.com/index.php?id=19
我希望如果你尝试删除?id=..
所以链接只是website.com/index.php
用户将被重定向到website.com/index.php?id=..
我该怎么做?
Use header
and $_GET
- for example:使用
header
和$_GET
- 例如:
if (!isset($_GET['id']) || empty($_GET['id'])) {
header('Location: /index.php?id=155');
exit();
}
Where 155
is whatever you want there to be. 155
是您想要的任何地方。
You can try like this你可以这样试试
if(!isset($_GET['id']))
{
header('location:index.php?id=here is your id value');
exit;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.