( ! ) Notice: Undefined property: Person::$showInfo in E:wampwwwview2.php on
程序员文章站
2022-05-23 20:31:49
...
新人小白求各位大神指点
( ! ) Notice: Undefined property: Person::$showInfo in E:\wamp\www\view2.php on line 17
class Person{
public $name;
private $salary;
protected $age;
function __construct($name,$age,$salary){
$this->name=$name;
$this->age=$age;
$this->salary=$salary;
}
public function showInfo(){
echo $this->name;
}
}
$p1=new Person("二货",30,1000);
$p1->showInfo;
?>
解决了 这么简单。。。。
大神你有没有什么学习php的好方法
( ! ) Notice: Undefined property: Person::$showInfo in E:\wamp\www\view2.php on line 17
class Person{
public $name;
private $salary;
protected $age;
function __construct($name,$age,$salary){
$this->name=$name;
$this->age=$age;
$this->salary=$salary;
}
public function showInfo(){
echo $this->name;
}
}
$p1=new Person("二货",30,1000);
$p1->showInfo;
?>
回复讨论(解决方案)
各位大神帮帮忙
$p1->showInfo ();
$p1->showInfo ();
解决了 这么简单。。。。
大神你有没有什么学习php的好方法
上一篇: 详细解读PHP发送邮件的实现办法
下一篇: log4j学习