2017-07-02 145 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」文件中導入所有的類變量,然後處理它們。 –