Created
November 8, 2018 07:57
-
-
Save hugotkk/e12e36237e3ef1d2bcc1084564f639c3 to your computer and use it in GitHub Desktop.
#twig, #htmlspecialchars, #htmlspecialchars_decode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prevent html injection eg: <h1>hihi</h1> | |
$text = htmlspecialchars($text) | |
// twig default with prevent the html injection | |
{{ text }} -> <h1>hihi</h1> | |
{{ text | raw }} -> <h1>hihi</h1> | |
// convert > -> >, does not need unless you want to be hacked with html | |
htmlspecialchars_decode($text); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment