• <bdo id='uvB0a'></bdo><ul id='uvB0a'></ul>
      <i id='uvB0a'><tr id='uvB0a'><dt id='uvB0a'><q id='uvB0a'><span id='uvB0a'><b id='uvB0a'><form id='uvB0a'><ins id='uvB0a'></ins><ul id='uvB0a'></ul><sub id='uvB0a'></sub></form><legend id='uvB0a'></legend><bdo id='uvB0a'><pre id='uvB0a'><center id='uvB0a'></center></pre></bdo></b><th id='uvB0a'></th></span></q></dt></tr></i><div id='uvB0a'><tfoot id='uvB0a'></tfoot><dl id='uvB0a'><fieldset id='uvB0a'></fieldset></dl></div>

      <legend id='uvB0a'><style id='uvB0a'><dir id='uvB0a'><q id='uvB0a'></q></dir></style></legend>
    1. <tfoot id='uvB0a'></tfoot>

        <small id='uvB0a'></small><noframes id='uvB0a'>

        如何将整理添加到 Laravel 查询

        时间:2023-09-22
          <bdo id='C4FWL'></bdo><ul id='C4FWL'></ul>

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

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

                • <tfoot id='C4FWL'></tfoot>
                • <legend id='C4FWL'><style id='C4FWL'><dir id='C4FWL'><q id='C4FWL'></q></dir></style></legend>

                    <tbody id='C4FWL'></tbody>
                • 本文介绍了如何将整理添加到 Laravel 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要像这样运行具有 collat​​e utf8_bin 的查询:

                  I need to run a query having collate utf8_bin like so:

                  SELECT * FROM `table` WHERE `field`='value' collate utf8_bin;
                  

                  这仅适用于管理脚本,我不想更新表字符集本身,仅适用于特定查询.

                  This is strictly for an admin script and I don't want to update the table charset itself, just for the particular query.

                  我可以使用 Eloquent ORM 来执行此操作还是需要写出此查询?

                  Can I do this using the Eloquent ORM or do I need to write this query out?

                  推荐答案

                  既然可以配置MySQL驱动使用一个:

                  Since you can configure MySQL driver to use one:

                  'mysql' => array(
                      'driver'    => 'mysql',
                      'host'      => 'localhost',
                      'database'  => 'database',
                      'username'  => 'root',
                      'password'  => '',
                      'charset'   => 'utf8',
                      'collation' => 'utf8_unicode_ci',
                      'prefix'    => '',
                  ),
                  

                  您可以为您的特定查询创建不同的连接:

                  You can create a different connection for your particular query:

                  'mysql-collation' => array(
                      'driver'    => 'mysql',
                      'host'      => 'localhost',
                      'database'  => 'database',
                      'username'  => 'root',
                      'password'  => '',
                      'charset'   => 'utf8',
                      'collation' => '<your collation>',
                      'prefix'    => '',
                  ),
                  

                  并在您的查询中使用该连接:

                  And use that connection on your query:

                  $users = DB::connection('mysql-collation')->select(...);
                  

                  在模型上,您可能可以通过这种方式设置连接:

                  On a Model, you probably will be able to set a connection this way:

                  $posts = new Word;
                  $posts->setConnection('mysql-collation');
                  $posts->where(...);
                  

                  这篇关于如何将整理添加到 Laravel 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 Laravel 5 中使用 orderBy Desc 获得平均值 下一篇:用户注册时自动创建个人资料(Laravel 5)

                  相关文章

                  最新文章

                  1. <legend id='WnrEv'><style id='WnrEv'><dir id='WnrEv'><q id='WnrEv'></q></dir></style></legend>
                    <tfoot id='WnrEv'></tfoot>

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