1
爲什麼我不能在類中的變量中使用分隔符(。)?PHP:在類中使用字符串分隔符時出錯
class Object(){
public $var = "Hello"."World";
# Or
public $test = "Hello";
public $var2 = $this->test."World";
}
此代碼給了我這個錯誤:
Parse error: syntax error, unexpected '.', expecting ',' or ';' in test.php on line 2
,我應該怎麼辦呢?