Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter月链接不工作_Codeigniter_Hyperlink_Calendar - Fatal编程技术网

Codeigniter月链接不工作

Codeigniter月链接不工作,codeigniter,hyperlink,calendar,Codeigniter,Hyperlink,Calendar,我的控制器 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Calendar extends MX_Controller { function index() { $this -> display( $year=null, $month=null); } function display($year=null,$month=null) {

我的控制器

<?php if ( ! defined('BASEPATH')) exit('No direct script access  allowed');
class Calendar extends MX_Controller
{

 function index()
{

    $this -> display( $year=null, $month=null);

}

function display($year=null,$month=null) 
{   
    if( ! $this->bitauth->logged_in())
    {       
        $this->session->set_userdata('redir', current_url());
        redirect('access/login');
    }
    $data['header']=Modules::run('header/header/index'); 
    $data['footer']=Modules::run('footer/footer/index');

    $conf=array(

        'start_day'=>'monday',
        'day_type'=> 'long',
        'show_next_prev'=>true,
        'next_prev_url'=>'http://datacentral.demo/calendar/'

        );

    $this->load->library('calendar',$conf);

    $this->load->view('calendar',$data);


}
}

当我更改月份时,url看起来很正常,例如,但我一直得到这个404错误未找到页面


我的配置文件中未指定路由。我遗漏了什么?

我相信您需要在下面创建一条路线:

$route['calendar/(:any)/(:any)'] = 'calendar/display';

尝试此路由链接:

$route['calendar/(:any)/(:any)'] = 'calendar/display/$1/$2';

这是一个开始,错误消失了,但是现在当我点击链接的时候,月份没有改变:P我想这是一个与路线有关的东西,我想?是一样的。不会改变月份。这是我下个月转到的顶部url:更新:这段代码echo$This->calendar->generate($year,$month)在控制器上工作。如何将变量$year、$month传递给我的视图?分配
$data['year']=$year
$data['year']=$year。然后在视图中回显
$year
$month
$route['calendar/(:any)/(:any)'] = 'calendar/display/$1/$2';