0

您好我收到此错误:警告:strtotime() 期望参数 1 为字符串

当我尝试这样做时:

$holidays = array("2008-12-25","2008-12-26","2009-01-01");
$today = date('Y-m-d');
$ticketDate = date('Y-m-d',strtotime($this->getCreateDate()));
$dayCount = $this->getWorkingDays($ticketDate,$today,$holidays);
$dayToHour = $dayCount * 24;
$horas=$cfg->getGracePeriod();
print_r ($holidays);

我明白了:Array ( [0] => 2008-12-25 [1] => 2008-12-26 [2] => 2009-01-01 ) 但是当我更换

$holidays = array("2008-12-25","2008-12-26","2009-01-01");

有了这个:

$holidays = array($cfg->holydays());

我明白了:

Warning: strtotime() expects parameter 1 to be string, array given in file.php on line 262
Array ( [0] => Array ( [0] => 2012-08-21 [1] => 2012-08-20 [2] => 2012-08-10 ) )

你能帮我吗?

4

1 回答 1

4

您将数组包装在数组中。看起来$cfg->holydays()已经返回了一个数组,所以一个简单的

$holidays = $cfg->holydays()

会成功的

于 2012-08-17T21:12:08.090 回答