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

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

      • <bdo id='ocgTa'></bdo><ul id='ocgTa'></ul>
      <tfoot id='ocgTa'></tfoot>

        <legend id='ocgTa'><style id='ocgTa'><dir id='ocgTa'><q id='ocgTa'></q></dir></style></legend>
      1. 严格标准:仅变量应通过引用 PHP 5.4 分配

        时间:2023-10-12
        • <legend id='5AKOz'><style id='5AKOz'><dir id='5AKOz'><q id='5AKOz'></q></dir></style></legend><tfoot id='5AKOz'></tfoot>
          • <bdo id='5AKOz'></bdo><ul id='5AKOz'></ul>
            1. <i id='5AKOz'><tr id='5AKOz'><dt id='5AKOz'><q id='5AKOz'><span id='5AKOz'><b id='5AKOz'><form id='5AKOz'><ins id='5AKOz'></ins><ul id='5AKOz'></ul><sub id='5AKOz'></sub></form><legend id='5AKOz'></legend><bdo id='5AKOz'><pre id='5AKOz'><center id='5AKOz'></center></pre></bdo></b><th id='5AKOz'></th></span></q></dt></tr></i><div id='5AKOz'><tfoot id='5AKOz'></tfoot><dl id='5AKOz'><fieldset id='5AKOz'></fieldset></dl></div>

                <tbody id='5AKOz'></tbody>

                <small id='5AKOz'></small><noframes id='5AKOz'>

                  本文介绍了严格标准:仅变量应通过引用 PHP 5.4 分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我将 PHP 版本升级到 5.4(XAMPP 1.7.3 到 1.8.0).现在我看到 Strict Standards 错误,对于 myDBconnection:

                  I upgraded my PHP version to 5.4 (XAMPP 1.7.3 to 1.8.0). Now I see Strict Standards error, for myDBconnection:

                  严格标准:C:xampphtdocsalousincludedbconn.php 第 4 行中的变量只能通过引用赋值

                  Strict Standards: Only variables should be assigned by reference in C:xampphtdocsalousincludedbconn.php on line 4

                  dbconn.php:

                  <?php
                      defined('_VALID') or die('Restricted Access!');
                  
                      $conn = &ADONewConnection($config['db_type']); // <--- This Line 4
                  
                      if ( !$conn->Connect($config['db_host'],
                                           $config['db_user'],
                                           $config['db_pass'],
                                           $config['db_name'])) {
                  
                          echo 'Could not connect to MySQL! Please check your database settings!';
                          die();
                      }
                      $conn->execute("SET NAMES 'utf8'");
                  ?>
                  

                  注意:我不需要使用此方法在 php.ini 中禁用 Strict Standards error_reporting = E_ALL &~E_NOTICE &~E_STRICT!我想修复我的 PHP 代码.

                  Note: I don't need to disable Strict Standards in php.ini with this method error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT! I want to fix my PHP code.

                  推荐答案

                  您应该删除 &(与号)符号,以便第 4 行看起来像这样:

                  You should remove the & (ampersand) symbol, so that line 4 will look like this:

                  $conn = ADONewConnection($config['db_type']);
                  

                  这是因为 ADONewConnection 已经通过引用返回了一个对象.根据文档,通过引用将引用的结果分配给对象从 PHP 5.3.0 开始,会产生 E_DEPRECATED 消息

                  This is because ADONewConnection already returns an object by reference. As per documentation, assigning the result of a reference to object by reference results in an E_DEPRECATED message as of PHP 5.3.0

                  这篇关于严格标准:仅变量应通过引用 PHP 5.4 分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 PHP 中,有人可以解释克隆 vs 指针引用吗? 下一篇:为什么在引用的值上调用函数(例如 strlen、count 等)这么慢?

                  相关文章

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

                  1. <small id='d3RDg'></small><noframes id='d3RDg'>

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

                      <tfoot id='d3RDg'></tfoot>

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