我需要一些帮助-我已经尝试设置setSpecificDate,以便我从数据库中获取(并格式化)的数组能够正确加载。当我打印$dates_booked时,格式是100%正确的"yyyy-mm-dd"-任何帮助/建议都将不胜感激。
有关日期选择器/关联代码的详细信息:http://www.triconsole.com/php/calendar_datepicker.php
提前感谢!
我的代码:
$datesArray = Array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$datesArray[] = $row['reserved_date'];
$dates_booked=implode(",",$datesArray);
$arrtrans = array();
$arrtrans[","] = '"'.",".'"';
$dates_booked = strtr($dates_booked,$arrtrans);
$dates_booked= '"'.$dates_booked.'"';
}
$myCalendar = new tc_calendar("date5", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2012, 2020);
$myCalendar->dateAllow(date("Y-m-d"), '2020-01-01');
$myCalendar->setDateFormat('j F Y');
//$myCalendar->setHeight(350);
// $myCalendar->autoSubmit(true, "form1");
$myCalendar->setAlignment('left', 'bottom');
// Problematic Line
$myCalendar->setSpecificDate(array('.$dates_booked.'
), 0, '');
$myCalendar->writeScript();
这个烂摊子:
$datesArray[] = $row['reserved_date'];
$dates_booked=implode(",",$datesArray);
$arrtrans = array();
$arrtrans[","] = '"'.",".'"';
$dates_booked = strtr($dates_booked,$arrtrans);
$dates_booked= '"'.$dates_booked.'"';
完全没有用。Yuo只需要这个:
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$datesArray[] = $row['reserved_date'];
}
/* ... */
$myCalendar->setSpecificDate($datesArray);