久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

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

    1. <i id='K6yXW'><tr id='K6yXW'><dt id='K6yXW'><q id='K6yXW'><span id='K6yXW'><b id='K6yXW'><form id='K6yXW'><ins id='K6yXW'></ins><ul id='K6yXW'></ul><sub id='K6yXW'></sub></form><legend id='K6yXW'></legend><bdo id='K6yXW'><pre id='K6yXW'><center id='K6yXW'></center></pre></bdo></b><th id='K6yXW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='K6yXW'><tfoot id='K6yXW'></tfoot><dl id='K6yXW'><fieldset id='K6yXW'></fieldset></dl></div>

        new mysqli():如何攔截“無法連接"錯誤?

        new mysqli(): how to intercept an #39;unable to connect#39; error?(new mysqli():如何攔截“無法連接錯誤?)
            <tbody id='uTGoc'></tbody>
            <bdo id='uTGoc'></bdo><ul id='uTGoc'></ul>
            <i id='uTGoc'><tr id='uTGoc'><dt id='uTGoc'><q id='uTGoc'><span id='uTGoc'><b id='uTGoc'><form id='uTGoc'><ins id='uTGoc'></ins><ul id='uTGoc'></ul><sub id='uTGoc'></sub></form><legend id='uTGoc'></legend><bdo id='uTGoc'><pre id='uTGoc'><center id='uTGoc'></center></pre></bdo></b><th id='uTGoc'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uTGoc'><tfoot id='uTGoc'></tfoot><dl id='uTGoc'><fieldset id='uTGoc'></fieldset></dl></div>

            <tfoot id='uTGoc'></tfoot>
          • <small id='uTGoc'></small><noframes id='uTGoc'>

              1. <legend id='uTGoc'><style id='uTGoc'><dir id='uTGoc'><q id='uTGoc'></q></dir></style></legend>
                  本文介紹了new mysqli():如何攔截“無法連接"錯誤?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在這樣做(是的,我使用了錯誤的連接數據,這是為了強制連接錯誤)

                  try {
                      $connection = new mysqli('localhost', 'my_user', 'my_password', 'my_db') ;
                  } catch (Exception $e ) {
                      echo "Service unavailable";
                      exit (3);
                  }
                  

                  但是 PHP 正在這樣做 php_warning:

                  But PHP is doing this php_warning:

                  mysqli::mysqli(): (28000/1045): 用戶 'my_user'@'localhost' 訪問被拒絕(使用密碼:YES)

                  mysqli::mysqli(): (28000/1045): Access denied for user 'my_user'@'localhost' (using password: YES)

                  在示例中,我使用錯誤的連接數據來強制連接錯誤,但在現實世界中,數據庫可能已關閉,或者網絡可能已關閉......等等.

                  In the example I'm using wrong connection data to force a connection error, but in the real world the database could be down, or the network could be down... etc..

                  問題:有沒有辦法在不抑制警告的情況下攔截數據庫連接問題?

                  Question: Is there a way, without suppressing warnings, to intercept a problem with the database connection ?

                  推薦答案

                  你需要告訴mysqli拋出異常:

                  You need to tell mysqli to throw exceptions:

                  mysqli_report(MYSQLI_REPORT_STRICT);
                  
                  try {
                       $connection = new mysqli('localhost', 'my_user', 'my_password', 'my_db') ;
                  } catch (Exception $e ) {
                       echo "Service unavailable";
                       echo "message: " . $e->message;   // not in live code obviously...
                       exit;
                  }
                  

                  現在您將捕獲異常并從那里獲取它.

                  Now you will catch the exception and you can take it from there.

                  這篇關于new mysqli():如何攔截“無法連接"錯誤?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                  PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                  How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)
                    <legend id='vVws0'><style id='vVws0'><dir id='vVws0'><q id='vVws0'></q></dir></style></legend>

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

                    <tfoot id='vVws0'></tfoot>
                      <tbody id='vVws0'></tbody>
                          <bdo id='vVws0'></bdo><ul id='vVws0'></ul>

                          1. <i id='vVws0'><tr id='vVws0'><dt id='vVws0'><q id='vVws0'><span id='vVws0'><b id='vVws0'><form id='vVws0'><ins id='vVws0'></ins><ul id='vVws0'></ul><sub id='vVws0'></sub></form><legend id='vVws0'></legend><bdo id='vVws0'><pre id='vVws0'><center id='vVws0'></center></pre></bdo></b><th id='vVws0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='vVws0'><tfoot id='vVws0'></tfoot><dl id='vVws0'><fieldset id='vVws0'></fieldset></dl></div>
                            主站蜘蛛池模板: 中文字幕在线免费观看 | 99re国产视频 | 中文字幕亚洲精品在线观看 | 天天爽夜夜爽精品视频婷婷 | 在线观看国产wwwa级羞羞视频 | 亚洲国产一区二区三区在线观看 | 91在线免费视频 | 亚洲日本视频 | 亚洲一区二区三区免费观看 | 亚洲一区二区久久 | 久久成人国产精品 | 亚洲视频中文 | 午夜免费影视 | 国产清纯白嫩初高生视频在线观看 | 日韩三区 | 日韩中文字幕在线视频 | 色视频www在线播放国产人成 | 国产偷录叫床高潮录音 | 日韩三级 | 中文字幕精品一区 | 午夜精品久久久久久久 | 亚洲毛片在线 | 亚洲精品一区二区三区在线 | 国产精品久久99 | 91精品国产日韩91久久久久久 | 一级做a毛片 | 少妇精品久久久久久久久久 | 国产一区视频在线 | 国产精品久久久一区二区三区 | 日韩一区二 | 精品自拍视频 | 免费观看羞羞视频网站 | 国产精品91网站 | 91精品国产91久久久久久吃药 | 国产精品99视频 | 国产9999精品 | 日本不卡一区二区三区在线观看 | 精品综合久久 | 操人网站| 亚洲 欧美 日韩在线 | 99re热精品视频 |