我收到以下错误解析错误:语法错误,第92行的路径中的意外T_VARIABLE /queries.php
因为数组$_queryArray
:
private $_queryA = "";
etc...
private $_queryV = "";
private $_queryArray = array( 'A' => $this->_queryA, //<= line 92 of my code
'B' => $this->_queryB,
'C' => $this->_queryC,
'D' => $this->_queryD,
'E' => $this->_queryE,
'F' => $this->_queryF,
'G' => $this->_queryG,
'H' => $this->_queryH,
'I' => $this->_queryI,
'J' => $this->_queryJ,
'K' => $this->_queryK,
'L' => $this->_queryL,
'M' => $this->_queryM,
'N' => $this->_queryN,
'O' => $this->_queryO,
'P' => $this->_queryP,
'Q' => $this->_queryQ,
'R' => $this->_queryR,
'S' => $this->_queryS,
'T' => $this->_queryT,
'U' => $this->_queryU,
'V' => $this->_queryV
);
我填充$_queryArray ?
谢谢!
答案 0 :(得分:2)
由于$ this引用了一个实例,并且在定义类时不存在,因此不能在属性定义中使用$ this
从docs
引用此声明可能包括初始化,但此初始化必须是常量值 - 也就是说,它必须能够在编译时进行评估,并且必须不依赖于运行时信息才能进行评估。
答案 1 :(得分:1)
我假设代码来自类声明。
我的猜测是你现在无法访问$ this。 尝试在构造函数中设置数组。
function __construct() {
$this->_queryArray = array( ... );
}