【发布时间】:2009-01-21 16:32:45
【问题描述】:
我在第 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;
}
}
我尝试将实例声明移动到第二个粘贴的代码中,但这会产生更多错误,因为“模块”调用的类也使用了一些“模板”类 - 所以会出现同样的问题更进一步。
我哪里弄错了她,或者完全错过了,我确定是后者,但我真的需要帮助。谢谢
【问题讨论】:
标签: php class object instantiation