我正在开发Wix小部件。包含我的小部件的iframe有这个由Wix:生成的URL
http://domain.com/wix/widget/?cacheKiller=123456&compId=hyeddksh&deviceType=桌面&实例=xxxxxxxxxxxxxx&locale=en&viewMode=编辑器&宽度=50
我尝试使用$_GET从URL中检索实例和compId值,但没有成功。
echo '<pre>';
print_r($_GET);
echo '</pre>';
给我
Array
(
[cacheKiller] => 123456
[amp;compId] => hyeddksh
[amp;deviceType] => desktop
[amp;instance] => xxxxxxxxxxxxxx
[amp;locale] => en
[amp;viewMode] => editor
[amp;width] => 50
)
关于在不使用$_GET[amp;compId]和$_GET[amp]instance] 编辑为了解决我的问题,我使用$compId = isset($_GET['compId']) ? $_GET['compId'] : $_GET['amp;compId'];
,我认为这不是正确的方式。任何人
作为超级快速肮脏的破解,您可以使用array_walk
。
array_walk($_GET, function($value, $key) use(&$_GET) {
$_GET[str_replace('amp;', '', $key)] = $_GET[$key];
unset($_GET[$key]);
});
在操作中查看
然后,您可以使用不带amp;
前缀的密钥。