我已在本地编写代码并且一切正常,我已尝试将其导入新系统并获得当前错误:
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 :(得分: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;
}