How to add a backslash before predefined characters in a string in the AnQi CMS template?
addslashes
The filter can specify a predefined character by adding a backslash in front of it. These characters are the single quote (’), double quote (”), and backslash (\).
How to use
addslashes
How to use filters:
{{ obj|addslashes }}
For example安企\"CMS\"
If you add a backslash to the predefined characters in it, you can write it like this:
{{ "安企\"CMS\""|addslashes|safe }}
# 显示结果
安企\"CMS\"
Sample Demo
{{ "安企CMS"|addslashes|safe }}
{{ "This is \\a Test. \"Yep\". 'Yep'."|addslashes|safe }}
# 显示结果
安企CMS
This is \\a Test. \"Yep\". \'Yep\'.