Answer the question
In order to leave comments, you need to log in
Is there something more logical for filtering requests?
There are many different shapes throughout the project. In fact, the user needs all the characters for a complete description. Perhaps there is something ready and tested? At the moment I'm doing it through a loop:
foreach ($request->all() as $key => $val) {
$new_val = htmlspecialchars(preg_quote(strip_tags($val),"'"), ENT_QUOTES);
$request->merge([$key => $new_val]);
}
Answer the question
In order to leave comments, you need to log in
In fact, the user needs all the characters for a complete description.
You need to escape only when you withdraw.
And the code that was attached here - throw it away and never get it.
1 . To write to the database, always use models , and the built-in ORM . He screens everything for you.
If you need html tags to be output in the usual way, use the following construction:
If for some reason you do not want to use Blade (and in vain, the tool is good) - use laravel's built-in function - e() helper for escaping:<?php echo e($title); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question