url_encode
的url_encode
filter percent将给定字符串编码为URL段或数组编码为查询字符串:
1 2 3 4 5 6 7 8
{{| path-seg *表示“状态”url_encode}}{#输出“path-seg%2Ament”#}{{"带空格的字符串"|url_encode}}{#输出“字符串%20与%20个空格”#}{{{'param': 'value', 'foo': 'bar'}| . {{{'param': 'value', 'foo': 'barurl_encode}}{#输出"param=value&foo=bar" #}
请注意
在内部,Twig使用PHPrawurlencode或者是http_build_query函数。