Escape raw SQL queries in Laravel 4

后端 未结 7 1004
别那么骄傲
别那么骄傲 2020-12-15 16:23

How does one go about escaping parameters passed to a raw query in Laravel 4? I expected something like DB::escape() (which rings a bell from Laravel 3) and als

7条回答
  •  鱼传尺愫
    2020-12-15 16:31

    You can quote your strings this way, through the DB facade.

    DB::connection()->getPdo()->quote("string to quote");
    

    I did put this answer in my question when I discovered it, however I've now put it in as an actual answer to make it easier for others to find.

提交回复
热议问题