dte49889 2018-08-16 11:14
浏览 89

PHP注册表有一个不推荐使用的构造函数错误[重复]

This question already has an answer here:

I am having Registry has a deprecated constructorError while running a php script.it shows the error on line 261. Going to that line I am having below codes.How to avoid this error.

class Registry {

function Registry() {

    define("CWD", ($getcwd = getcwd() ? $getcwd : "."));
    $config = array();
    include INCLUDES . "config.php";

    if (sizeof($config) == 0) {
        if (file_exists(INCLUDES . "config.php")) {
            exit( "<div style=\"border: 1px dashed #cc0000;font-family:Tahoma;background-color:#FBEEEB;width:100%;padding:10px;color:#cc0000;\"><strong>Welcome to EvolutionScript 5.1 FULL</strong><a></a><br>Before you can begin using EvolutionScript you need to perform the installation procedure. <a href=\"" . (file_exists( "install/install.php" ) ? "" : "../") . "install/install.php\" style=\"color:#000;\">Click here to begin ...</a><br></div>" );
        }
        else {
            exit("<br /><br /><strong>Configuration</strong>: includes/config.php does not exist. Please fill out the data in config.php.new and rename it to config.php");
        }
    }

    $this->config = $config;

    define("TABLE_PREFIX", trim($this->config['Database']['tableprefix']));
    define("COOKIE_PREFIX", (empty($this->config['Misc']['cookieprefix']) ? "ptc" : $this->config['Misc']['cookieprefix']) . "_");
  }
}
</div>
  • 写回答

1条回答 默认 最新

  • dpb75177 2018-08-16 11:17
    关注

    Constructors named the same as class name are considered PHP4 style and got deprecated since PHP 7. I know it's common to use such convention in other OOP languages but PHP promotes magic method named __construct() instead. More info here: http://php.net/manual/en/migration70.deprecated.php

    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题