我的网址来自:locahhost/index1.php?option=com_lsh&view=lsh&event_id=xxxxx&tv_id=xxx&tid=xxxx&channel=x
当用户单击此链接时,文件index1.php
应处理此 URL 然后生成
这种形式的新 URL localhost/static/popups/xxxxxxxxxxx.html 其中 xxxxxxxxxxxx 是
event_id、tv_id、tid 和 chanel。
为此,我在文件中使用解析 url 函数,index1.php
如下所示:
<?php
$url = 'http://localhost/index1.php?option=com_lsh&view=lsh&event_id=&tv_id=&tid=&channel=';
$parsed = parse_url( $url );
parse_str( $parsed['query'], $data );
$newurl = 'http://localhost.eu/static/popups/'.$data['event_id'].$data['tv_id'].$data['tid'].$data['channel'].'.html';
header("Location: $newurl");
?>
但它不起作用我认为这是由于出现问题 $url = 'http://localhost/index1.php?option=com_lsh&view=lsh&event_id=&tv_id=&tid=&channel=';
这有什么问题?我也想要它,例如当 tv_id 不存在于 url 中时,它在 newurl 中放置了 0