在WAMP本地主机上运行PHP,我正在尝试将$_GET['sku']
从一个页面传递到另一个通过URL的页面,例如
<a href="selection.php?sku='<?PHP echo trim($_GET['sku']);?>'" role="button" class="btn to-selection">Add to Selection</a>
此将数据传递到下一页,但我得到了
,而$_GET['sku']
是MO-1103
。为什么在参数前后会出现这些散列?
答案 0 :(得分:3)
您要在sku '
== %27
周围添加'
<a href="selection.php?sku='<?PHP echo trim($_GET['sku']);?>'" role="button" class="btn to-selection">Add to Selection</a>
// here>>>>>>>>>>>>> ^ and here >>>> ^
因此将该行更改为
<a href="selection.php?sku=<?PHP echo trim($_GET['sku']);?>" role="button" class="btn to-selection">Add to Selection</a>
答案 1 :(得分:0)
这来自HTML本身。它们是代表无法通过URL发送的实体的代码。 %27表示单引号。