2013-09-23 66 views
0

我已经写在本地我的代码,一切工作正常,我试图将它导入到一个新的系统,并获取当前的错误:缺少参数1属性:: __结构(),

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); 

的init.php

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;  
    } 

感谢

+0

编辑不是改进 – Dale

+0

Wheres init.php line 18?我只看到前7行+ IDontKnow.php的一些行... – SergeS

+0

你怎么不使用xPDO? –

回答

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;  
} 
+0

我可以删除classes/xml_upload,但仍然显示sames错误。 – Brent

+0

@BrentFrench,我更新了答案,在你的问题中粘贴了回溯信息。 – srain

+0

这是由于某种原因修复了错误和作品,奇怪:S谢谢 – Brent