0
古怪的分析器錯誤:警告:array_keys()預計參數1是陣列,NULL給出
Notice: Undefined property: template::$param in
C:\xampp\htdocs\app\includes\classes\class.template.php on line 37
Warning: array_keys() expects parameter 1 to be array, null given in
C:\xampp\htdocs\app\includes\classes\class.template.php on line 37
Notice: Undefined property: template::$param in
C:\xampp\htdocs\app\includes\classes\class.template.php on line 37
Warning: array_values() expects parameter 1 to be array, null given in
C:\xampp\htdocs\app\includes\classes\class.template.php on line 37
代碼:
public function newParam($trans, $value) {
$this->param['{' . $trans . '}'] = $value;
}
public function getParam($content) {
$content = str_replace(
array_keys($this->param),
array_values($this->param),
$content
);
return $content;
}
請注意,這不是任何現有的解析器。
看來,由於某種原因,你的'$這個 - > param'是'null'。 – Hamatti
除了你在這裏的東西,我們需要看到你實際實例化這個類並調用'getParam()'的代碼。看起來''this-> param'在調用getParam()'的時候沒有被初始化。 $ param'屬性初始化爲類屬性,如'public $ param = array();'? –
請發佈整個類聲明。我對'$ this-> param'包含什麼特別感興趣。 –