我需要一些帮助 - 我已经尝试设置setSpecificDate,以便从数据库中获取(并已格式化)的数组将正确加载。当我打印$ dates_booked格式是100%正确“yyyy-mm-dd” - 任何帮助/建议将不胜感激。
有关datepicker /相关代码的更多信息: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();
答案 0 :(得分:0)
这个烂摊子:
$datesArray[] = $row['reserved_date'];
$dates_booked=implode(",",$datesArray);
$arrtrans = array();
$arrtrans[","] = '"'.",".'"';
$dates_booked = strtr($dates_booked,$arrtrans);
$dates_booked= '"'.$dates_booked.'"';
完全没用。你只需要这个:
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$datesArray[] = $row['reserved_date'];
}
/* ... */
$myCalendar->setSpecificDate($datesArray);