I would like to ask for advice on the value transfer problem of class attributes. Thank you very much.
蛋炒饭
蛋炒饭 2019-12-09 17:44:09
0
0
738
class selectCondition { private $intervalNum; private $arrayParameter; private $DateInterval; private $startDate; private $EndDate; function __construct($intervalNum,$unit,$EndDate='',$conditionName=[],$arrayParameter=[]) { $this->intervalNum=$intervalNum; $this->DateInterval='P'.$intervalNum.$unit; $this->EndDate=new DateTime(); if($EndDate!=''){ $arydate=explode('-', $EndDate); $this->EndDate=$this->EndDate->setDate($arydate[0],$arydate[1],$arydate[2]); } $this->startDate=$this->EndDate; $this->startDate=$this->startDate->sub(new DateInterval($this->DateInterval)); } public function dateRange() { return $this->startDate->format('Y-m-d').'至'.$this->EndDate->format('Y-m-d'); } /* $today=new selectCondition(3,'D');$today->dateRange(); 输出结果:2019-12-06至2019-12-06 为什么不是2019-12-06至2019-12-09 属性间是地址传递?该怎么解决?谢谢 */



蛋炒饭
蛋炒饭

reply all (0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!