2017-07-02 184 views
0

我想在下面的链接中使用这个日期选择器(日期3脚本)日历日期选择器 - PHP

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> 
+0

你能提供'a.php'的内容? – timiTao

+0

@timiTao我刚刚加了 –

回答

0

你需要日历php文件在你的a.php只会之前使用它呢?

require_once('classes/tc_calendar.php'); 

如果是这样,不要给错误的路径文件?

+0

以上对不起,我没有得到路径的东西,是文件'班'应该在我保留所有脚本的目录里面? –

0

你必须先要求开始使用它之前,你的“tc_calendar.php”文件,直接让它的第一行开始PHP的标签,例如后:

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

这将帮助你从你的“tc_calendar.php”文件中导入所有的类变量,然后处理它们。 –