0

私はこのリダイレクトを行っています:

$perf = get_query_var('goperf');
$campaignid = get_option('campaign_id');
$url = 'http://ww.mysite.com?test=1&testtwo=2';
header("HTTP/1.1 301 Moved Permanently");
header('Location: '.$url); 
exit;

私は使用する必要があります:

$url = 'http://ww.mysite.com?test=1&testtwo=2';

または、& をエンコードする必要がありますか? & の代わりに & を使用する

$url = 'http://ww.mysite.com?test=1&esttwo=2';

タイ

4

1 に答える 1

5

URL が HTML ドキュメントに挿入されている場合にのみ、htmlencoded バリアントを使用する必要があります。

あなたが持っている場合:

<a href="<?php echo $url;?>">click me!</a>

&amp;バリアント(htmlエンコード)を使用する必要があります

あなたがやっている場合:

header("Location: " . $url);

または最初のケースではない他のものは、htmlencodeしないでください。

于 2013-06-28T00:20:52.490 に答える