文章摘要
这篇文章介绍了一个PHP函数`go_url`及其调用流程。该函数通过`header`函数设置HTTP头返回301永久链接,并通过`exit`函数跳转到指定的URL。代码中使用`$_GET`获取一个名为`id`的参数,并根据`id`的值决定返回的`URL`:如果`id`等于`art`、`Crafts`或`automotive`,则返回`https://www.1004619.com/`;否则返回`http://www.www.com`。最后,函数`go_url`被调用。文章的核心内容在于`URL`生成和跳转机制的实现。
<?php
function go_url($url) {
header('HTTP/1.1 301 Moved Permanently');
exit(header('location:'.$url));
}
//通过get函数获取id
$id = $_GET['id'];
if($id == art){
$url = "https://www.1004619.com/";
}else if($id == Crafts){
$url = "https://www.1004619.com/";
}else if($id == automotive){
$url = "https://www.1004619.com/";
}else{
$url = "http://www.www.com";
}
go_url($url);
?>
新增方法,改下id
}else if($id == 3){
$url = "http://www.www.com";

Villain博客
