pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    • <bdo id='UwmRZ'></bdo><ul id='UwmRZ'></ul>

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

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

    1. <tfoot id='UwmRZ'></tfoot>
      <i id='UwmRZ'><tr id='UwmRZ'><dt id='UwmRZ'><q id='UwmRZ'><span id='UwmRZ'><b id='UwmRZ'><form id='UwmRZ'><ins id='UwmRZ'></ins><ul id='UwmRZ'></ul><sub id='UwmRZ'></sub></form><legend id='UwmRZ'></legend><bdo id='UwmRZ'><pre id='UwmRZ'><center id='UwmRZ'></center></pre></bdo></b><th id='UwmRZ'></th></span></q></dt></tr></i><div class="xxhlxr7" id='UwmRZ'><tfoot id='UwmRZ'></tfoot><dl id='UwmRZ'><fieldset id='UwmRZ'></fieldset></dl></div>
      1. E_STRICT 有什么作用?

        What does E_STRICT do?(E_STRICT 有什么作用?)

            <tbody id='VtRpM'></tbody>
          <tfoot id='VtRpM'></tfoot>

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

          • <bdo id='VtRpM'></bdo><ul id='VtRpM'></ul>
              <legend id='VtRpM'><style id='VtRpM'><dir id='VtRpM'><q id='VtRpM'></q></dir></style></legend>

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

                  本文介紹了E_STRICT 有什么作用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我實際上很想確保我們的代碼庫沒有錯誤,PHP 的內置錯誤檢查會警告這些錯誤,但我想確切地了解 E_STRICT 強制執行的內容.通過擴展,PHP 的嚴格標準"是什么?我查看了但找不到完整的列表.

                  I'm actually interested in making sure our codebase is free of errors that would be warned against by PHP's builtin error checking, but I'd like to see exactly what E_STRICT enforces. By extension, what are PHP's "strict standards"? I looked but couldn't find a comprehensive list.

                  我從經驗中了解到的一些嚴格標準:

                  Some strict standards that I know offhand from experience:

                  • 警告不要靜態調用非靜態方法
                  • 警告不兼容的子類函數簽名
                  • 警告不要通過引用分配值

                  我所知道的關于 E_STRICT 的全部內容是它對可能破壞向前兼容性的代碼發出警告,但我不確定這具體意味著什么.

                  All I know about E_STRICT is that it warns against code which might break forward compatibility, but I'm not sure what that means concretely.

                  有沒有關于這方面的信息的好資源?

                  Is there a good resource out there for information on this?

                  推薦答案

                  E_STRICT 和嚴格標準"是一回事.(并且 它們在 PHP 7 中被移除.)

                  E_STRICT and "strict standards" are the same thing. (And they're removed in PHP 7.)

                  該文檔目前沒有 E_STRICT 特定警告的列表,但我們可以通過搜索 PHP 源代碼.

                  The documentation presently has no list of E_STRICT-specific warnings, but we can construct one reasonably easily by searching the PHP source.

                  以下列表(我認為自 PHP 5.6 起是準確的)是通過以下方法在 Unix 系統上形成的:

                  The list below (which I believe to be accurate as of PHP 5.6) was formed on a Unix system via the following methodology:

                  1. 克隆 PHP Git 存儲庫:

                  1. Cloning the PHP Git repo:

                  git clone https://github.com/php/php-src
                  

                2. 正在檢查 5.6.0 版:

                3. Checking out version 5.6.0:

                  cd php-src
                  git checkout PHP-5.6.0
                  

                4. 搜索包含 E_STRICT 的所有 C 文件(帶有 .h.c 擴展名的文件):

                5. Searching for all C files (ones with .h and .c extensions) containing E_STRICT:

                  grep --include=*.[ch] -rl . -e E_STRICT
                  

                6. 手動查看 (21) 個匹配文件中的每一個以查找發出 E_STRICT 警告的代碼,嘗試推斷發出警告的情況(我不是 C程序員,但對這些東西做出很好的猜測并不太難,尤其是代碼中的人類可讀錯誤消息可以指導您)然后在交互式 PHP shell 中測試它們以確保我是對的.

                7. Manually looking through each of the (21) matched files to find code emitting E_STRICT warnings, attempting to deduce the circumstances in which the warning would be emitted (I'm not a C programmer, but it's not too hard to take a good guess at this stuff, especially with the human-readable error messages right there in the code to guide you) then testing them at the interactive PHP shell to make sure I was right.

                  鑒于上述方法略顯粗糙,并且依賴于以下假設:E_STRICT 可以在源代碼中所有發出 E_STRICT 警告的地方旁邊找到,我可能遺漏了一些東西 - 但希望這至少接近成為一個全面的列表.

                  Given that the methodology described above is slightly crude and depends upon the assumption that E_STRICT can be found in the source code next to all places where E_STRICT warnings are emitted, it's possible I've missed some stuff - but this is hopefully at least close to being a comprehensive list.

                  1. 調用mktime()沒有參數

                  php > mktime();
                  PHP Strict Standards:  mktime(): You should be using the time() function
                  instead in php shell code on line 1

                8. 使用資源作為數組索引>

                9. Using a resource as an array index

                  php > $file_pointer = fopen('/dev/null', 'r');
                  php > $array = [3,4,5,6];
                  php > $array[$file_pointer];
                  PHP Strict Standards:  Resource ID#2 used as offset, casting to integer (2)
                  in php shell code on line 1

                10. 將 UTF-8 以外的多字節編碼傳遞給 htmlentities

                  php > htmlentities('qwertyuiop', 0, 'BIG5');
                  PHP Strict Standards:  htmlentities(): Only basic entities substitution is
                  supported for multi-byte encodings other than UTF-8; functionality is
                  equivalent to htmlspecialchars in php shell code on line 1

                11. 聲明一個抽象 靜態方法

                  php > abstract class Foo { static abstract function bar(); }
                  PHP Strict Standards:  Static function Foo::bar() should not be abstract in
                  php shell code on line 1

                12. 使用 聲明一個類__construct 方法和 舊式構造函數以類命名的函數

                  php > class MyClass {
                  php {     function MyClass () {}
                  php {     function __construct () {}
                  php { }
                  PHP Strict Standards:  Redefining already defined constructor for class
                  MyClass in php shell code on line 3

                13. 調用mysqli_next_resultmysqli::next_result 在沒有準備下一個結果的 Mysqli 連接對象上

                14. Calling mysqli_next_result or mysqli::next_result on a Mysqli connection object that does not have a next result to prepare

                  php > $conn = mysqli_connect('127.0.0.1', 'root');
                  php > mysqli_multi_query($conn, "SELECT 'first'; SELECT 'second';");
                  php > echo mysqli_use_result($conn)->fetch_row()[0];
                  first
                  php > mysqli_next_result($conn);
                  php > echo mysqli_use_result($conn)->fetch_row()[0];
                  second
                  php > mysqli_next_result($conn);
                  PHP Strict Standards:  mysqli_next_result(): There is no next result set.
                  Please, call mysqli_more_results()/mysqli::more_results() to check whether
                  to call this function/method in php shell code on line 1

                15. 覆蓋子類中的方法以將不同數量的參數傳遞給其父類中的同一方法

                16. Overriding a method in a subclass to take a different number of arguments to the same method in its parent

                  php > class A           { public function foo ($x) {} }
                  php > class B extends A { public function foo () {} }
                  PHP Strict Standards:  Declaration of B::foo() should be compatible with
                  A::foo($x) in php shell code on line 1
                  php > class C extends A { public function foo ($x, $y) {} }
                  PHP Strict Standards:  Declaration of C::foo() should be compatible with
                  A::foo($x) in php shell code on line 1

                17. 在特征和使用它的類中以兼容方式聲明相同的屬性.這個實際上很好文檔化:

                  如果一個trait定義了一個屬性,那么一個類就不能定義一個同名的屬性,否則會報錯.如果類定義兼容(相同的可見性和初始值),則為 E_STRICT,否則為致命錯誤.

                  If a trait defines a property then a class can not define a property with the same name, otherwise an error is issued. It is an E_STRICT if the class definition is compatible (same visibility and initial value) or fatal error otherwise.

                  <?php
                  trait PropertiesTrait {
                      public $same = true;
                      public $different = false;
                  }
                  
                  class PropertiesExample {
                      use PropertiesTrait;
                      public $same = true; // Strict Standards
                      public $different = true; // Fatal error
                  }
                  ?>
                  

                  嚴格模式警告示例:

                  php > trait PropertiesTrait {
                  php {     public $same = true;
                  php { }
                  php > class PropertiesExample {
                  php {     use PropertiesTrait;
                  php {     public $same = true;
                  php { }
                  PHP Strict Standards:  PropertiesExample and PropertiesTrait define the
                  same property ($same) in the composition of PropertiesExample. This might
                  be incompatible, to improve maintainability consider using accessor
                  methods in traits instead. Class was composed in php shell code on line 4

                18. 靜態調用非靜態方法

                19. Calling a non-static method statically

                  php > class Foo { function bar() {} }
                  php > Foo::bar();
                  PHP Strict Standards:  Non-static method Foo::bar() should not be called
                  statically in php shell code on line 1

                20. 非靜態地引用靜態屬性

                21. Referring to a static property non-statically

                  php > class Cow { static public $noise = 'moo'; }
                  php > $cow = new Cow;
                  php > $cow->noise = "MOOOOO";
                  PHP Strict Standards:  Accessing static property Cow::$noise as non static
                  in php shell code on line 1

                22. 直接傳遞函數調用的結果通過引用.

                  php > function foo () { return 1; }
                  php > function bar (&$some_arg) {} 
                  php > bar(foo());
                  PHP Strict Standards:  Only variables should be passed by reference in php
                  shell code on line 1
                  php > $var = &foo();
                  PHP Strict Standards:  Only variables should be assigned by reference in
                  php shell code on line 1

                  請注意,通過引用傳遞其他非變量(如文字或常量)是致命錯誤,而不是 E_STRICT

                  Note that passing other non-variables by reference, like literals or constants, is a fatal error instead of an E_STRICT

                  這篇關于E_STRICT 有什么作用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  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@“localhost的訪問被拒絕)
                    <tbody id='cpNTw'></tbody>

                  • <tfoot id='cpNTw'></tfoot>

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

                          • <legend id='cpNTw'><style id='cpNTw'><dir id='cpNTw'><q id='cpNTw'></q></dir></style></legend>
                          • <small id='cpNTw'></small><noframes id='cpNTw'>

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

                            主站蜘蛛池模板: 丙烷/液氧/液氮气化器,丙烷/液氧/液氮汽化器-无锡舍勒能源科技有限公司 | 动物麻醉机-数显脑立体定位仪-北京易则佳科技有限公司 | 临沂招聘网_人才市场_招聘信息_求职招聘找工作请认准【马头商标】 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | wika威卡压力表-wika压力变送器-德国wika代理-威卡总代-北京博朗宁科技 | 德州网站制作 - 网站建设设计 - seo排名优化 -「两山建站」 | 神超官网_焊接圆锯片_高速钢锯片_硬质合金锯片_浙江神超锯业制造有限公司 | 海外仓系统|国际货代系统|退货换标系统|WMS仓储系统|海豚云 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 小型单室真空包装机,食品单室真空包装机-百科 | 塑料熔指仪-塑料熔融指数仪-熔体流动速率试验机-广东宏拓仪器科技有限公司 | 飞飞影视_热门电影在线观看_影视大全 | 丝印油墨_水性油墨_环保油墨油漆厂家_37国际化工 | 除尘布袋_液体过滤袋_针刺毡滤料-杭州辉龙过滤技术有限公司 | 无线联网门锁|校园联网门锁|学校智能门锁|公租房智能门锁|保障房管理系统-KEENZY中科易安 | 上海软件开发-上海软件公司-软件外包-企业软件定制开发公司-咏熠科技 | 广州活动策划公司-15+年专业大型公关活动策划执行管理经验-睿阳广告 | 石家庄网站建设|石家庄网站制作|石家庄小程序开发|石家庄微信开发|网站建设公司|网站制作公司|微信小程序开发|手机APP开发|软件开发 | 模切之家-专注服务模切行业的B2B平台!| 北京易通慧公司从事北京网站优化,北京网络推广、网站建设一站式服务商-北京网站优化公司 | 洗地机-全自动/手推式洗地机-扫地车厂家_扬子清洁设备 | 磁力抛光机_磁力研磨机_磁力去毛刺机_精密五金零件抛光设备厂家-冠古科技 | 六自由度平台_六自由度运动平台_三自由度摇摆台—南京全控科技 | 润滑脂-高温润滑脂-轴承润滑脂-食品级润滑油-索科润滑油脂厂家 | 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 焊接减速机箱体,减速机箱体加工-淄博博山泽坤机械厂 | 暖气片十大品牌厂家_铜铝复合暖气片厂家_暖气片什么牌子好_欣鑫达散热器 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 重庆波纹管|重庆钢带管|重庆塑钢管|重庆联进管道有限公司 | 杭州月嫂技术培训服务公司-催乳师培训中心报名费用-产后康复师培训机构-杭州优贝姆健康管理有限公司 | 驾驶人在线_专业学车门户网站| 分类168信息网 - 分类信息网 免费发布与查询| 热处理炉-退火炉-回火炉设备厂家-丹阳市电炉厂有限公司 | 淬火设备-钎焊机-熔炼炉-中频炉-锻造炉-感应加热电源-退火机-热处理设备-优造节能 | 上海网站建设-上海网站制作-上海网站设计-上海做网站公司-咏熠软件 | 高效节能电机_伺服主轴电机_铜转子电机_交流感应伺服电机_图片_型号_江苏智马科技有限公司 | 液氨泵,液化气泵-淄博「亚泰」燃气设备制造有限公司 | 电主轴-高速精密电主轴-高速电机厂家-瑞德沃斯品牌有限公司 | 庭院灯_太阳能景观灯_草坪灯厂家_仿古壁灯-重庆恒投科技 | 电缆接头_防水接头_电缆防水接头 - 乐清市新豪电气有限公司 | 抖音短视频运营_企业网站建设_网络推广_全网自媒体营销-东莞市凌天信息科技有限公司 |