日历日期选择器 - PHP

时间:2017-07-02 07:53:41

标签: javascript php

我正在尝试在(日期3脚本)下面的链接中使用此日期选择器。

http://www.triconsole.com/php/calendar_datepicker.php

它向我显示了这个错误:

Fatal error: Uncaught Error: Class 'tc_calendar' not found in C:\xampp\htdocs\test\a.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\a.php on line 5

我应该怎么做才能纠正它?

由于

这是a.php脚本:

<html>
<head><script language="javascript" src="calendar.js"></script></head>
<body>
<?php
$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(2000, 2017);
      $myCalendar->dateAllow('2008-05-13', '2017-03-01');
      $myCalendar->setDateFormat('j F Y');
      $myCalendar->setAlignment('left', 'bottom');
      $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');
      $myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month');
      $myCalendar->setSpecificDate(array("2011-06-01"), 0, '');
      $myCalendar->writeScript();


?>
<form action="somewhere.php" method="post">
<?php
//get class into the page
require_once('classes/tc_calendar.php');

//instantiate class and set properties
$myCalendar = new tc_calendar("date5", true);

$myCalendar->setDate(1, 1, 2000);

//output the calendar
$myCalendar->writeScript();   

?>
</form>
</body>
 </html>

3 个答案:

答案 0 :(得分:0)

在使用它之前,您是否在a.php中需要日历php文件?

require_once('classes/tc_calendar.php');

如果是这样,你不提供错误的文件路径吗?

答案 1 :(得分:0)

您没有导入课程tc_calendar。 Todo所以你需要下载tc_calendar并将它放在你的解决方案中。

然后你需要包含php类,例如include();

http://php.net/manual/en/function.include.php

答案 2 :(得分:0)

在开始使用它之前,你必须首先要求你的“tc_calendar.php”文件,并在启动php标签之后直接让它成为第一行:

<?php 
//get class into the page
require_once('classes/tc_calendar.php');
$myCalendar = new tc_calendar("date5", true, false);
相关问题