我对 PHP 编程很陌生。我正在尝试做一些不是很困难的事情,但是遵循非常基本的代码既不会返回错误,也不会显示任何输出。玩弄我猜它与 $this->... 行有关,我无法弄清楚为什么在对象内部调用函数不起作用。请帮忙 !!!
class TargetBuy {
public $ClientCode;
public $Service;
public $ServiceType; // Emissione, Cambio, Riemissione, Rimborso, NoShow...
public $RateType; // tipo tariffa
public $Segment; // tratta
public $CityHotel;
public $TicketType; // one way or round trip
public $AdvancePurchase;
public $Penalty;
public $Taxes; // 0=NotIncluded; 1=Included
public $FinalPrice;
function CalculateTB_Price() {
$this->ClientCode='Hello';
echo $ClientCode;
}
}
$TB = new TargetBuy;
$TB->CalculateTB_Price();