我正在尝试将URL作为参数传递,但该URL也有参数.当然,这些参数很重要,必须传输和正确解释.
例如:http: //example.com/myclicktrackingscript.php?source = sidebar&url = http://example.com/redirect_to.php?site = site1
(是的,我知道,我可以在一个文件中单击跟踪并重定向所有,但在某些特定情况下,我不能:有时我需要传递带参数的任何URL作为参数)
到目前为止,我已经使用了URL重写:http: //example.com/redirect_to.php?site = site1 => http://example.com/redirect/site1/
..但这不是很方便(太多需要更多灵活性的具体情况)
有没有更好的方法呢?
我的猜测可能是散列参数URL:
例如:http://example.com/myclicktrackingscript.php? source = sidebar $ url = REJREJ12333232rerereE
......但是如何正确地"去除"它呢?
我从来没有使用过这样的技术,有没有关于如何做的任何例子/提示/建议?
谢谢
你应该只编码参数:
urlencode('http://example.com/redirect_to.php?site=site1')
Run Code Online (Sandbox Code Playgroud)
编码值将是: http%3A%2F%2Fexample.com%2Fredirect_to.php%3Fsite%3Dsite1