我是 PHP 新手,所以仍然了解构造的工作原理,我将不胜感激!
以下代码无法回显变量 $arrivalTime 和 $hourStay:
class Variable {
public $arrivalTime;
public $hourStay;
public function __construct() {
$this->arrivalTime = $_POST['arrivalTime'];
$this->hourStay = $_POST['hourStay'];
echo $this->arrivalTime;
echo $this->hourStay;
}
}