设置类成员变量时,我收到以下错误。如何在c#.net
解析错误:语法错误,意外T_VAR
,期待T_VARIABLE
,请帮我修复它。我是PHP的新手
<?php
class clsCustomer{
public var $customercode;
public var $customername;
public var $customeraddress;
public function PrintCustomerDetails(){
echo $this->customercode." ".$this->customername." ".$this->customeraddress;
}
}
$obj = new clsCustomer();
$obj->customercode = 1;
$obj->customername = "Shiv";
$obj->customeraddress = "Mumbai India";
$obj->PrintCustomerDetails();
?>
答案 0 :(得分:0)
从属性声明中删除var
个关键字:
class clsCustomer{
public $customercode;
public $customername;
public $customeraddress;
...
}
进一步阅读