我正在尝试从扩展类中检索变量。这是我的主要课程的外观:
class SS {
public $NONE = NULL;
public $NUMBERS = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
public $OPERATORS = array("=", "&&", ">", "<", "+", "-", "/", "*", "^");
public $DBLQUOTES = '"$1"';
public $SNGQUOTES = "'$1'";
public $CODE;
function SuperSyn($sCode, $cLang) {
$hLang = new VB6;
$VB6 = $hLang->__construct();
echo $VB6->ssAuthor;
}
}
我的扩展类看起来像这样(我删除了许多关键字)。
class VB6 extends SS {
public function __construct() {
$ssAuthor = "James Brooks";
$ssCSS = "languages/vb6.css";
$ssNumbers = $NUMBERS;
$ssKeywords = array("Abs", "Access", "AddItem");
$ssReserved = $NONE;
$ssComments = "('.+)";
$ssOperators = $OPERATORS;
$ssDoubleQuote = $NONE;
$ssSingleQuote = $NONE;
}
}
如果我删除被调用的公共函数 __construct,PHP 会认为它需要一个函数。
我的问题是,如何将扩展类中的变量检索到我的主类中?