我应该如何在 formmail 脚本中重定向用户?
所以我使用基本的 formmail 脚本。在脚本中我使用了重定向变量。重定向的值类似于:
http://www.mysite.com/NewOLS_GCUK_EN/bling.aspx?BC=GCUK&IBC=CSEE&SIBC=CSEE
但是,当发生重定向操作时,URL 在浏览器中显示为:
http://www.mysite.com/NewOLS_GCUK_EN/bling.aspx?BC=GCUK&IBC=CSEE&SIBC=CSEE
您可以看到 &
字符被替换为 &
有什么办法可以解决这个问题吗?
So I'm using a basic formmail script. Within the script I'm using a redirect variable. The value of the redirect is something like:
http://www.mysite.com/NewOLS_GCUK_EN/bling.aspx?BC=GCUK&IBC=CSEE&SIBC=CSEE
When the redirect action happens however, the URL appears in the browser as:
http://www.mysite.com/NewOLS_GCUK_EN/bling.aspx?BC=GCUK&IBC=CSEE&SIBC=CSEE
You can see the &
characters are replaced with &
Is there any way to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以使用字符串替换来编辑脚本:
或者也许查看正在发生相反替换的脚本,并注释掉该步骤。
Maybe you can edit the script with a string substitution:
Or perhaps look in the script where the opposite substitution is taking place, and comment out that step.
HTML::Entities的decode_entities可以为你解码:
但是传递目标URL因为 HTTP 参数(例如隐藏表单字段)是危险的(正如@Sinan Ünür 在评论中已经说过的那样)。最好将目标 URL 存储在脚本中,并从表单中传递选择器:
使用哈希会更短:
HTML::Entities's decode_entities could decode this for you:
But passing the destination URL as HTTP argument (e.g. hidden form field) is dangerous (as @Sinan Ünür already said in the comments). Better store the target URL within your script and pass a selector from the form:
Using a Hash would be shorter: