日历预订系统出错 [英] Error in calendar booking system
问题描述
我在PHP中有一个日历预订系统,以下是它的代码片段。
我正在运行WampServer2.4
I have a 'calendar booking system' in PHP and below are code snippets of that. I am running WampServer2.4
<?
include('php/connect.php');
include('classes/class_calendar.php');
$calendar = new booking_diary($link);
if (isset($_GET['month'])) $month = $_GET['month']; else $month = date("0");
if (isset($_GET['year'])) $year = $_GET['year']; else $year = date("0");
if (isset($_GET['day'])) $day = $_GET['day']; else $day = 0;
$selected_date = mktime(0, 0, 0, $month, 01, $year); // Make a timestamp based on the GET values
$first_day = date("N", $selected_date) - 1; // Gives numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
$back = strtotime("-1 month", $selected_date);
$forward = strtotime("+1 month", $selected_date);
?>
和
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$calendar->after_post($month, $day, $year);
}
// Call calendar function
$calendar->make_calendar($selected_date, $first_day, $back, $forward, $day, $month, $year);
?>
而且函数是
function make_calendar($selected_date, $first_day, $back, $forward, $day, $month, $year) {
// Add a value to these public variables
$this->day = $day;
$this->month = $month;
$this->year = $year;
$this->selected_date = $selected_date;
$this->first_day = $first_day;
$this->back = $back;
$this->back_month = date("m", $back);
$this->back_year = date("Y", $back); // Minus one month back arrow
$this->forward = $forward;
$this->forward_month = date("m", $forward);
$this->forward_year = date("Y", $forward); // Add one month forward arrow
// Make the booking array
$this->make_booking_array($year, $month);
}
运行代码,我得到这个恼人的错误。
But when I try to run the code, I am getting this annoying error.
注意:未定义的变量: \\ wamp \www\calendar\calendar.php on line 42
Notice: Undefined variable: calendar in C:\wamp\www\calendar\calendar.php on line 42
致命错误:调用C中非对象的成员函数make_calendar() \wamp\www\calendar\calendar.php第42行
Fatal error: Call to a member function make_calendar() on a non-object in C:\wamp\www\calendar\calendar.php on line 42
。
推荐答案
您的函数 make_calendar c $ c>被定义?根据您的代码,它应该在booking_diary类
where your function make_calendar()
is defined? According to your code, it should be in booking_diary class
这篇关于日历预订系统出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!