2
I recently started using the Laravel and found the function {{}}
very useful, because even if it is a Javascript, not active, unlike the echo
in the PHP.
I was wondering if you could do the same thing at PHP
Example to basic:
<?php
echo "<script> alert(\"Hello! I am an alert box!!\");</script>";
?>
He will execute the Javascript, however in Laravel with the {{}}
it will show what is written but without executing the Javascript.
is because in the
{{}}
is if you want to display a variable from the controller. Ex:{{ $variavel }}
if I’m not mistaken, echo also works on Laravel. Now you can run a normal javascript inside a Blade.php file– adventistaam
Use the function
htmlentities
before theecho
.– Valdeir Psr
Explain it better there? Got a little confused.
– bfavaretto