0

我已经在本地编写了代码,一切正常,我尝试将其导入新系统并收到当前错误:

Warning: Missing argument 1 for Properties::__construct(), called in 
/home/hghdigib/public_html/system/core/init.php on line 18 and defined in
/home/hghdigib/public_html/classes/properties_data.php on line 8

页面显示功能

include( str_replace('/core/', '/system/core/init.php', MODX_CORE_PATH) );
$db = new Mysqlidb('localhost','user','pass','database');
$properties = new Properties($db);
$properties->showLatest(3);

初始化文件

define('CORE_PATH', dirname(__FILE__));

try

{

    require_once("classes/database.php");
    require_once("classes/properties_data.php");
    require_once("classes/xml_upload.php");

}

catch (Exception $e)

{
    die('Error loading system.');
}

Properties_data.php 第 1-8 行

    class Properties {
    public $db;
    function __construct($db) {
        $this->db = $db;    
    }

谢谢

4

1 回答 1

3

当你使用:

require_once("classes/database.php");
require_once("classes/properties_data.php");
require_once("classes/xml_upload.php");

需要文件,检查classes/xml_upload.php,可能有一些代码要调用class Properties

如何调试?更改Properties为:

class Properties {
public $db;
function __construct($db = null) {
    if (null == $db) {
        // here you will see the back trace info
        print_r(debug_backtrace());
    }
    $this->db = $db;    
}
于 2013-09-23T10:15:57.203 回答