let's say that you are going to print some data from the database on a web page or are going to insert it into the database as an input, for example,
{{ $tenant->name }}
and the meaning of the thought $tenant->name is something like
<script> alert("Errors...."); </script>
after rendering in the browser you will get an alert . This is a security issue, so we need to avoid providing this content, and we do not need this data from the database.
therefore we need to misinform this data
to make laravel provide some options
HTML::entities($tenant->name);
and e() is also a helper function of HTML::entities
and you can get the same behavior using
e($tenant->name);
if $tenant->name - <script>alert("Errors....");</script> , then after applying to e() you will get something lower,
"<script> alert("Errors...."); </script>"
it is no longer a process as a script
here is a good recipe
OR is there an easy way to do this
use triple curly braces {{{ }}} instead of double curly braces {{ }} this will also sanitize the contents.
K.Toress
source share