Do I need to clean user input for DB::query calls in laravel?
问题 Reading the Laravel documentation I see that: Note: The Laravel query builder uses PDO parameter binding throughout to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings. Does that still apply if I only craft queries in the following manner? DB::query("SELECT * from table WHERE id like " . $id); 回答1: Let's take that sentence and emphasise the key phrase: There is no need to clean strings being passed as bindings . In your example