How to escape URL parameters in AnqiCMS templates?
urlencodeThe filter can escape URL parameters.
iriencodeThe filter can escape url parameters, except for/#%[]=:;$&()+,!?*@'~[The characters outside of this, will be escaped in the same way as URL parameters.]
Usage Instructions
urlencodeHow to use the filter:
{{ obj|urlencode }}
iriencodeHow to use the filter:
{{ obj|iriencode }}
For example, if you need to split?foo=123&bar=yesIf escaping is used, it can be written like this:
{{ "http://www.example.org/foo?a=b&c=d"|urlencode }}
# 显示结果
http%3A%2F%2Fwww.example.org%2Ffoo%3Fa%3Db%26c%3Dd
Here is an example demonstration
{{ "http://www.example.org/foo?a=b&c=d"|urlencode }}
{{ "?foo=123&bar=yes"|iriencode }}
# 显示结果
http%3A%2F%2Fwww.example.org%2Ffoo%3Fa%3Db%26c%3Dd
?foo=123&bar=yes