【发布时间】:2011-10-26 02:50:12
【问题描述】:
class ea_framework {
public function outer() {
function inner() {
}
}
}
这似乎不可能?
我真的是 PHP 类的新手,任何建议都将不胜感激!
这是我的测试用例:
# Site Class
class ea_framework {
public function __construct() {
$this->init();
}
public function init() {
$this->header();
}
public function header() {
function head_start() {
# Doctype
echo "<!DOCTYPE html>\n";
# Begin HTML
echo "<html class='".agent()."'>\n";
# Begin HEAD
echo "<head>\n";
}
$this->head_start();
}
}
$bro = new ea_framework();
错误:
Fatal error: Call to undefined method ea_framework::head_start() in /home/tfbox/domains/ibrogram.com/public_html/i/construction/core/run.php on line 31
【问题讨论】:
-
为什么说它“似乎不可能”?当你尝试它时,你的测试用例会发生什么?你的测试用例是什么?
-
这样做的目的是什么?
-
@deceze 学习曲线。向班级介绍自己,到目前为止还没有那么好,哈哈。