<small id='1WNIv'></small><noframes id='1WNIv'>

<tfoot id='1WNIv'></tfoot>
    • <bdo id='1WNIv'></bdo><ul id='1WNIv'></ul>

    <legend id='1WNIv'><style id='1WNIv'><dir id='1WNIv'><q id='1WNIv'></q></dir></style></legend>

        <i id='1WNIv'><tr id='1WNIv'><dt id='1WNIv'><q id='1WNIv'><span id='1WNIv'><b id='1WNIv'><form id='1WNIv'><ins id='1WNIv'></ins><ul id='1WNIv'></ul><sub id='1WNIv'></sub></form><legend id='1WNIv'></legend><bdo id='1WNIv'><pre id='1WNIv'><center id='1WNIv'></center></pre></bdo></b><th id='1WNIv'></th></span></q></dt></tr></i><div id='1WNIv'><tfoot id='1WNIv'></tfoot><dl id='1WNIv'><fieldset id='1WNIv'></fieldset></dl></div>
      1. 使用 Eloquent ORM/laravel 准备好的语句

        时间:2023-09-22

        <i id='ktvwL'><tr id='ktvwL'><dt id='ktvwL'><q id='ktvwL'><span id='ktvwL'><b id='ktvwL'><form id='ktvwL'><ins id='ktvwL'></ins><ul id='ktvwL'></ul><sub id='ktvwL'></sub></form><legend id='ktvwL'></legend><bdo id='ktvwL'><pre id='ktvwL'><center id='ktvwL'></center></pre></bdo></b><th id='ktvwL'></th></span></q></dt></tr></i><div id='ktvwL'><tfoot id='ktvwL'></tfoot><dl id='ktvwL'><fieldset id='ktvwL'></fieldset></dl></div>
      2. <legend id='ktvwL'><style id='ktvwL'><dir id='ktvwL'><q id='ktvwL'></q></dir></style></legend>

                  <bdo id='ktvwL'></bdo><ul id='ktvwL'></ul>
                  <tfoot id='ktvwL'></tfoot>

                • <small id='ktvwL'></small><noframes id='ktvwL'>

                    <tbody id='ktvwL'></tbody>
                  本文介绍了使用 Eloquent ORM/laravel 准备好的语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我是 laravel 的新手,并将其用作输入查询:

                  I'm new to laravel and use this as a input query:

                  DB::table('user_input')->insert(array(
                                  array('fname' => Input::get('Name'),'lname' => 'no','email' => Input::get('E-Mail'),'date_from' => $from_date,'date_to' => $to_date,'phone' => Input::get('Phone'),'message' => Input::get('Message'),'ip_address' => Request::getClientIp(), 'newsletter' => Input::get('Sign-up'))
                  
                              ));
                  

                  在标准 php 中我永远不会这样做,因为查询似乎没有准备好,我将用户输入直接放入上面的查询中.

                  which I would never do like that in standard php, as the query doesn't seem to be prepared and I put user input directly into above query.

                  在 Eloquent ORM 中是否有我不认识的自动准备,或者我将如何使用 Eloquent 编写准备好的语句?

                  Is there a automatic preparation in Eloquent ORM which I haven't recognized or how would I write a prepared statement with Eloquent?

                  推荐答案

                  Eloquent 在幕后执行 PDO 样式的准备语句,以防止诸如 sql 注入之类的事情.默认情况下,Eloquent 模型还可以防止质量分配.除非您特别注意应保护的数据库列或相反的列(应可填充的列),否则将引发异常.

                  Eloquent does the PDO style prepared statements behind the scenes to protect against things like sql injection. Eloquent models also protect against mass assignment by default. An exception will be thrown unless you specifically note the columns of the database that should be guarded or the inverse (the ones that should be fillable).

                  http://laravel.com/docs/4.2/eloquent#mass-assignment

                  想深入了解的可以看类

                  /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php` 
                  

                  看看 laravel 如何在 Eloquent 中构建查询.

                  to see how laravel constructs the queries in Eloquent.

                  这篇关于使用 Eloquent ORM/laravel 准备好的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Laravel 获取祖先(URL) 下一篇:Laravel 5.2 - 左加入 DB::Raw 不起作用?

                  相关文章

                  最新文章

                  <i id='kRy74'><tr id='kRy74'><dt id='kRy74'><q id='kRy74'><span id='kRy74'><b id='kRy74'><form id='kRy74'><ins id='kRy74'></ins><ul id='kRy74'></ul><sub id='kRy74'></sub></form><legend id='kRy74'></legend><bdo id='kRy74'><pre id='kRy74'><center id='kRy74'></center></pre></bdo></b><th id='kRy74'></th></span></q></dt></tr></i><div id='kRy74'><tfoot id='kRy74'></tfoot><dl id='kRy74'><fieldset id='kRy74'></fieldset></dl></div>
                  1. <legend id='kRy74'><style id='kRy74'><dir id='kRy74'><q id='kRy74'></q></dir></style></legend>

                      <bdo id='kRy74'></bdo><ul id='kRy74'></ul>

                  2. <small id='kRy74'></small><noframes id='kRy74'>

                  3. <tfoot id='kRy74'></tfoot>