讀Laravel documentation我看到:我是否需要在laravel中清理DB ::查詢調用的用戶輸入?
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.
這是否仍然適用,如果我只按照以下方式查詢手藝?
DB::query("SELECT * from table WHERE id like " . $id);
爲什麼你在這裏使用'like'運算符? – zerkms
是的,我知道我可以使用Wuery Builder進行這樣一個簡單的查詢,但是有時我必須再次運行一個查詢,我會動態構建一個字符串。 – WildBill
爲什麼不能使用查詢生成器動態地構建查詢? – zerkms