How to escape URL parameters in AnqiCMS templates?
urlencode
The filter can escape URL parameters.
iriencode
The filter can escape url parameters, except for/#%[]=:;$&()+,!?*@'~
[The characters outside of this, will be escaped in the same way as URL parameters.]
Usage Instructions
urlencode
How to use the filter:
{{ obj|urlencode }}
iriencode
How to use the filter:
{{ obj|iriencode }}
For example, if you need to split?foo=123&bar=yes
If 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