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

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

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

    <i id='r1MQH'><tr id='r1MQH'><dt id='r1MQH'><q id='r1MQH'><span id='r1MQH'><b id='r1MQH'><form id='r1MQH'><ins id='r1MQH'></ins><ul id='r1MQH'></ul><sub id='r1MQH'></sub></form><legend id='r1MQH'></legend><bdo id='r1MQH'><pre id='r1MQH'><center id='r1MQH'></center></pre></bdo></b><th id='r1MQH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='r1MQH'><tfoot id='r1MQH'></tfoot><dl id='r1MQH'><fieldset id='r1MQH'></fieldset></dl></div>
      <bdo id='r1MQH'></bdo><ul id='r1MQH'></ul>
    1. PHP 中的錯誤處理

      Error handling in PHP(PHP 中的錯誤處理)
          <tbody id='FTtf5'></tbody>

          <legend id='FTtf5'><style id='FTtf5'><dir id='FTtf5'><q id='FTtf5'></q></dir></style></legend>

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

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

                <bdo id='FTtf5'></bdo><ul id='FTtf5'></ul>
              • 本文介紹了PHP 中的錯誤處理的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我熟悉一些基礎知識,但我想了解更多關于何時以及為什么應該在 PHP 中使用錯誤處理(包括拋出異常),尤其是在實時站點或 Web 應用程序中.它是否可以被過度使用,如果是,過度使用是什么樣的?是否有不應該使用的情況?另外,在錯誤處理方面有哪些常見的安全問題?

                I'm familiar with some of the basics, but what I would like to know more about is when and why error handling (including throwing exceptions) should be used in PHP, especially on a live site or web app. Is it something that can be overused and if so, what does overuse look like? Are there cases where it shouldn't be used? Also, what are some of the common security concerns in regard to error handling?

                推薦答案

                要補充已經說過的一件事是,將 Web 應用程序中的任何錯誤記錄到日志中是最重要的.這樣,正如 Jeff Coding Horror" Atwood 所建議的那樣,當您的用戶在使用您的應用程序時遇到問題時,您就會知道(而不是詢問他們出了什么問題").

                One thing to add to what was said already is that it's paramount that you record any errors in your web application into a log. This way, as Jeff "Coding Horror" Atwood suggests, you'll know when your users are experiencing trouble with your app (instead of "asking them what's wrong").

                為此,我推薦以下類型的基礎設施:

                To do this, I recommend the following type of infrastructure:

                • 在您的數據庫中創(chuàng)建一個崩潰"表和一組用于報告錯誤的包裝類.我建議為崩潰設置類別(阻塞"、安全"、PHP 錯誤/警告"(與異常)等).
                • 在您的所有錯誤處理代碼中,確保記錄錯誤.始終如一地執(zhí)行此操作取決于您構建 API(上述步驟)的程度 - 如果操作正確,記錄崩潰應該微不足道.

                額外的功勞:有時,您的崩潰將是數據庫級別的崩潰:即數據庫服務器關閉等.如果是這種情況,您的錯誤記錄基礎架構(以上)將失敗(您無法將崩潰記錄到數據庫中,因為日志嘗試寫入數據庫).在這種情況下,我會在您的 Crash 包裝器類中將故障轉移邏輯編寫為

                Extra credit: sometimes, your crashes will be database-level crashes: i.e. DB server down, etc. If that's the case, your error logging infrastructure (above) will fail (you can't log the crash to the DB because the log tries to write to the DB). In that case, I would write failover logic in your Crash wrapper class to either

                • 向管理員發(fā)送電子郵件,和/或
                • 將崩潰的詳細信息記錄到純文本文件中

                所有這些聽起來都有些矯枉過正,但相信我,這會影響您的應用程序是被接受為穩(wěn)定"還是不穩(wěn)定".這種差異源于這樣一個事實,即所有應用程序一開始都是不穩(wěn)定/崩潰的,但那些了解其應用程序所有問題的開發(fā)人員有機會實際修復它.

                All of this sounds like an overkill, but believe me, this makes a difference in whether your application is accepted as a "stable" or "flaky". That difference comes from the fact that all apps start as flaky/crashing all the time, but those developers that know about all issues with their app have a chance to actually fix it.

                這篇關于PHP 中的錯誤處理的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環(huán))
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)

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

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

                      <bdo id='HzL9T'></bdo><ul id='HzL9T'></ul>
                          <i id='HzL9T'><tr id='HzL9T'><dt id='HzL9T'><q id='HzL9T'><span id='HzL9T'><b id='HzL9T'><form id='HzL9T'><ins id='HzL9T'></ins><ul id='HzL9T'></ul><sub id='HzL9T'></sub></form><legend id='HzL9T'></legend><bdo id='HzL9T'><pre id='HzL9T'><center id='HzL9T'></center></pre></bdo></b><th id='HzL9T'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HzL9T'><tfoot id='HzL9T'></tfoot><dl id='HzL9T'><fieldset id='HzL9T'></fieldset></dl></div>
                          主站蜘蛛池模板: h免费观看 | 国产免费让你躁在线视频 | 亚洲成人999 | av二区三区 | 亚洲国产精品视频 | 91精品国产一区二区三区 | 日韩免费一级 | 亚洲国产精品一区二区第一页 | 中文字幕一二三区 | 在线视频一区二区 | 成人午夜av | 成人午夜免费视频 | 国产精品久久久久久久久久免费看 | 成人三级电影 | 中文精品视频 | 日韩电影中文字幕 | 中文字幕一区二区三区乱码在线 | 四虎成人免费视频 | 91一区| 我要看黄色录像一级片 | 精品国产91乱码一区二区三区 | 欧美在线视频网 | 激情五月婷婷综合 | 不卡一区二区三区四区 | 在线观看av网站 | 99久久免费精品国产男女高不卡 | 久热电影| 日本成人免费观看 | 三级成人在线 | 一区二区三区四区在线 | 亚洲三级在线 | 久久久网| 天天av网| 久久激情视频 | 99re国产| 国产999精品久久久久久绿帽 | 国产精品一区二区久久久久 | 国内精品在线视频 | 在线欧美亚洲 | 男女免费视频网站 | 日本在线视频一区二区 |