為什么出錯了 大家?guī)臀铱纯丛趺椿厥?/h1>
<?php
date_default_timezone_set("PRC")
class Human{
public $name;
public $height;
public $weight;
public function eat($food){
echo this->name."'s eating ".$food."\n";
}
}
class NbaPlayer extends Human{
public $team="Bull";
public $playerNumber="23";
function __construct($name, $height, $weight, $team, $playerNumber){
$this->name=$name;
$this->height=$height;
$this->weight=$weight;
}
function __destruct(){
echo "Destroying".$this->name."\n";
}
public function run(){
echo "Running\n";
}
public function jump(){
echo "jumping\n";
}
public function dribble(){
echo "Dribbling\n";
}
$jordan=new NbaPlayer("Jordan","198cm","98kg","Bull","23");
echo $jordan->name."\n";
$jordan->eat("Apple");
}
?>
網頁提示 ? 錯誤?Parse error: syntax error, unexpected 'class' (T_CLASS) in F:\Demo\test.php on line?3
<?php
date_default_timezone_set("PRC")
class Human{
public $name;
public $height;
public $weight;
public function eat($food){
echo this->name."'s eating ".$food."\n";
}
}
class NbaPlayer extends Human{
public $team="Bull";
public $playerNumber="23";
function __construct($name, $height, $weight, $team, $playerNumber){
$this->name=$name;
$this->height=$height;
$this->weight=$weight;
}
function __destruct(){
echo "Destroying".$this->name."\n";
}
public function run(){
echo "Running\n";
}
public function jump(){
echo "jumping\n";
}
public function dribble(){
echo "Dribbling\n";
}
$jordan=new NbaPlayer("Jordan","198cm","98kg","Bull","23");
echo $jordan->name."\n";
$jordan->eat("Apple");
}
?>
網頁提示 ? 錯誤?Parse error: syntax error, unexpected 'class' (T_CLASS) in F:\Demo\test.php on line?3
2016-04-19
一般出錯時,要在error line 的前后行找一找,基本上就能找到error了!