Nim*_*imi 2 php parameters redirect header ampersand
我有参数:
http://example.com?ex=http://la.net?c1=a1&c2=a2&c3=a3
Run Code Online (Sandbox Code Playgroud)
我想重定向到此 URL,但当我这样做时,我会进入
http://example.com?ex=http://la.net?c1=a1
Run Code Online (Sandbox Code Playgroud)
我知道是因为这个&标志...
您应该对传递给 URL 的参数进行编码:
$url = "http://example.com?ex=".urlencode("http://la.net?c1=a1&c2=a2&c3=a3");
header('Location: '.$url);
Run Code Online (Sandbox Code Playgroud)