我有下面的類和它不接受$ this關鍵字的方法。 有人可以GUID
<?php
class test {
function __construct($x, $y, $z){
$this->$x = $x;
$this->testFunction();
public static function testFunction(){
print '<br> here it is:'.$this->$x.'--<br>';
}
//========================================================================================================================
}
?>
它給了我這個錯誤
Fatal error: Using $this when not in object context
self :: $ x ..試試! – Stewie 2010-11-10 17:21:00
也許不相關,但是在構造函數上的錯誤結束}錯字?如果不是,那需要關閉。 – 2010-11-10 17:21:28
請重新格式化您的代碼,因爲它似乎缺少一個}。 @ Stewie,這是另一個錯誤,它並不真的造成致命的錯誤。 – Shoe 2010-11-10 17:21:44