【发布时间】:2018-05-04 12:40:52
【问题描述】:
请检查我的问题,我制作了一个脚本,但 $contractempsal 变量不起作用。我想要员工工资,但我出错了。请检查。
下面是我的代码:-
<?php
class baseemp {
protected $firstname;
protected $lastname;
public function getfullname() {
return $this->firstname .''. $this->lastname;
}
public function __construct($first,$last) {
$this->firstname="$first";
$this->lastname="$last";
}
}
class fulltimeemp extends baseemp {
public $monthlysal;
public function monthlysalary() {
$this->monthlysal/12;
}
}
class contractemp extends baseemp {
public $hourlyrate;
public $totalhours;
public function monthlysalaryy() {
$this->hourlyrate * $this->totalhours;
}
public function __construct($hourrate,$totalhoursd){
$this->hourlyrate="$hourrate";
$this->totalhours="$totalhoursd";
}
}
$fulltimeemployee = new fulltimeemp("kannu"," singh");
$contractempsal = new contractemp("400","5");
echo $fulltimeemployee->getfullname();
echo $contractempsal->getfullname();
?>
所以,这是我的代码。请检查并告诉我哪里错了谢谢
请检查我的问题,我制作了一个脚本,但 $contractempsal 变量不起作用。我想要员工工资,但我出错了。请检查。
【问题讨论】:
-
“我出错了”什么错误?你已经做了哪些调试?
-
对不起,我没有收到错误,它显示空白屏幕
-
我只是想得到员工的薪水,但它什么也没显示:(
-
检查您的错误日志和/或启用错误报告。
-
你从我的代码中认为这合适吗??