$ _GET无法使用& 在URL中
Im working on a Wix widget. The iframe containing my widget has this URL generated by Wix:
I tried retriving the instance and compId values from the URL using $_GET but no luck.
echo '<pre>';
print_r($_GET);
echo '</pre>';
gives me
Array
(
[cacheKiller] => 123456
[amp;compId] => hyeddksh
[amp;deviceType] => desktop
[amp;instance] => xxxxxxxxxxxxxx
[amp;locale] => en
[amp;viewMode] => editor
[amp;width] => 50
)
Any idea about retrieving these values without using $_GET[amp;compId] and $_GET[amp;instance]?
EDIT
To solve my issue, I am using $compId = isset($_GET['compId']) ? $_GET['compId'] : $_GET['amp;compId'];
which I believe is not the right way. Anyone?
我正在处理Wix小部件。 包含我的小部件的iframe具有由Wix生成的URL: p>
我尝试从中恢复实例和compId值 使用$ _GET但没有运气的URL。 p>
echo'&lt; pre&gt;'; print_r($ _ GET); echo'&lt; / pre&gt;'; \ n code> pre>
给我 p>
Array ( [cacheKiller] =&gt; 123456 [amp; compId] =&gt; hyeddksh [amp; deviceType] =&gt; desktop [amp; instance] =&gt; xxxxxxxxxxxxxx [amp; locale] =&gt; en [amp; viewMode] =&gt; editor [amp; width] =&gt; 50 ) code> pre>
有关检索这些值的任何想法 使用 $ _ GET [amp; compId] strong>和 $ _ GET [amp; instance] strong>? p>
编辑 strong > 要解决我的问题,我使用
$ compId = isset($ _ GET ['compId'])? $ _GET ['compId']:$ _GET ['amp; compId']; code>我认为这不是正确的方法。 有人吗? p> div>
As a mega quick and dirty hack, you could use array_walk
.
array_walk($_GET, function($value, $key) use(&$_GET) {
$_GET[str_replace('amp;', '', $key)] = $_GET[$key];
unset($_GET[$key]);
});
Then you can use the keys without the amp;
prefix.