回应后期价值

时间:2012-04-25 18:12:39

标签: php codeigniter

我正在试图找出它为什么回应$ bookingDate。我的代码中没有任何echo或print语句,所以很难理解为什么它在响应控制台中回显。我希望有人能看到导致这个问题的原因。

    function submitBooking()
    {
        $outputArray = array('error' => 'yes', 'message' => 'unproccessed');
        $outputMsg = '';
        // Sets validation rules for the login form
        $this->form_validation->set_rules('eventName', 'Event Name',
            'is_natural_no_zero');
        $this->form_validation->set_rules('label', 'Label',
            'is_natural_no_zero');
        $this->form_validation->set_rules('bookingDate', 'Booking Date',
            'required');
        $this->form_validation->set_rules('location', 'Location',
            'required');
        $this->form_validation->set_rules('arena', 'Arena',
            'is_natural_no_zero');  
        $this->form_validation->set_rules('introduction', 'Introduction',
            'required');

        // Checks to see if login form was submitted properly
        if (!$this->form_validation->run())
        {
            $outputArray['message'] =
                'There was a problem submitting the form! Please refresh the window and try again!';
        }
        else
        {
            $bookingDate = $this->input->post('bookingDate');
            $bookingDate = date("d-m-Y h:i:s", strtotime($bookingDate));


            if ($this->eventsmodel->bookEvent($this->input->post('eventName'), $this->input->post('label'), $bookingDate, $this->input->post('location'), $this->input->post('arena'), $this->input->post('introduction')))
            {
                $outputArray = array('success' => 'Yes', 'message' =>
                                            'The event was booked successfully!');
            }
            else
            {
                $outputArray['message'] =
                'The event was not booked! Please try again later!';
            }
        }
        echo json_encode($outputArray);
    }

1 个答案:

答案 0 :(得分:1)

eventsmodel->bookEvent中查找 echo语句。你可能会在那里回应$bookingDate。这里一切都很好。

希望这有帮助。