即使对象已被调用,我也会在第 35 行的 page.class.php 中的非对象上调用成员函数 process_data()。
这是 index.php 提取显示正在实例化的对象
// require our common files
require("modules/module.php");
require("registry/objects/datetime.class.php");
require("registry/objects/page.class.php");
// load in all the objects
$datetime = new dateandtime;
$page = new page;
$module = new module;
然后它传递给 Process 类
require("template.class.php");
$template = new template($php_path . "controllers/themes/adm/" . $page . ".html");
// Place in both commonly used language and page specific language
$template->language($php_path . "controllers/language/en/adm/common.php");
$template->language($php_path . "controllers/language/en/adm/" . $page . ".php");
// Tell the page's module to load in data it needs
$module->process_data("module_" . $page);
// Output the final result
$template->output();
正是在这一点上,PHP 正在抛出错误。module.php文件内容如下
class module {
public function process_data ($child) {
require($child . ".php");
read_data();
return true;
}
}
我已经尝试将实例声明移动到第二个粘贴的代码中,但这会产生更多错误,因为“模块”调用的类也使用了一些“模板”类 - 所以同样的问题发生在更远的地方线。
我哪里错了她,或者完全错过了,我确定是后者,但我真的需要帮助。谢谢