使用Play 2对网址进行编码 [英] Encode an URL with Play 2
本文介绍了使用Play 2对网址进行编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Play 2在模板中编码URL?
How can I encode an URL in a template with Play 2?
我这样搜索助手:
<a href="@urlEncode(name)">urlEncode doesn't work now</a>
我找到了拉动请求,但这似乎不适用于实际的play 2.0. 3发布.
I have found a pull request, but this doesn't seem to work with the actual play 2.0.3 release.
推荐答案
从2.1开始,您可以使用@helper.urlEncode
As of 2.1 you can use @helper.urlEncode
<a href="@helper.urlEncode(foo)">my href is urlencoded</a>
这篇关于使用Play 2对网址进行编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文