HTML链接转义的URL作为查询字符串传递 [英] HTML link escaping url passed as query string

查看:39
本文介绍了HTML链接转义的URL作为查询字符串传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下链接:

$ this-> HTML-> link('admin',array('admin'=> true,'controller'=>'users','action'=>'login','?'=> array('continue'=> $ this->此处)))

哪个链接应该显示为: http://domain.com/admin/login?continue=/location

Which should produce a link like: http://domain.com/admin/login?continue=/location

但是它总是转义/,所以我得到一个链接,例如: http://domain.com/admin/login?continue=%2Flocation

However it always escapes the / so I get a link like: http://domain.com/admin/login?continue=%2Flocation

如何停止此操作?我在链接中尝试了 array('escape'=> false),但仅转义了链接本身,而不是 href .

How do I stop this? I tried array('escape'=>false) in the link but that only escapes the link itself rather than the href.

推荐答案

您需要在蛋糕处理完之后手动将此部分添加到url中:

You either need to manually add this part to the url after it went through cake:

$this->Html->url(...).'?continue=/location'

我不推荐(可能是无效的网址!)

which I don't recommend (likely invalid url!)

或者您可以在目标操作中使用url_decode()再次接收正确的字符串(通常蛋糕也应该自动执行此操作).检查$ this-> request-> params [named] [location]键包含的内容:

or you use url_decode() in the target action to receive the correct string again (should cake usually do automatically, as well). check what the $this->request->params[named][location] key contains:

array('admin'=>true,'controller'=>'users','action'=>'login','continue'=>$this->here)

糟糕.在1.3中,它仍然是$ this-> params [named] [location]!

ops. in 1.3 it is still $this->params[named][location] !

这篇关于HTML链接转义的URL作为查询字符串传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆