无法从codeigniter中的前端控制器调用后端控制器中的函数

时间:2018-08-01 14:57:59

标签: php codeigniter xampp

我有一个特殊的问题,因此无法找到任何解决方案,有人可以在这里指导我。 我有一个可以在我的虚拟主机上完美运行的网站,但是当我将其下载到本地服务器上并将其托管在xampp服务器上时,出现一个非常奇怪的错误 调用重定向时,它无法在控制器中找到函数。

下面是此类的代码

class Site extends FrontendController {
 .
 .
 .
 .
  public function login(){
    if( !empty( $_POST['Login'] ) ){

            /* user has submitted login information */

            $this->cuseridentity->init( $_POST['Login']['user_name'], $_POST['Login']['password'] );
            if( $this->cuseridentity->authenticate() && $this->cuseridentity->login() ){
                /* user was able to login */
                switch( $this->cuseridentity->get_data( 'role' ) ){
                    case 'admin':
                        redirect ( 'admin/product/index' ) ; //This is not working
                    break;
                    case 'counter': 
                        redirect( 'store/index' ); // this works
                    break;
                    case 'user': //invcounter
                        redirect( 'invcounter/dashboard/index' ) ; //( this does not work'gallery' ); 
                    break;
                    default :
                        redirect( 'gallery ') ; //this works 
                    break;
                }
            }

    }
    $this->load->view( 'site/login' );

}

This is in my routes file 
$route['default_controller'] = 'store/index';
$route['login'] = 'site/login';
$route['login/(:any)'] = 'site/login/$1';  
$route['index'] = 'store/index';
$route['productindex'] = 'admin/product/productindex' ;
//$route['product/(:any)/(:any)'] = 'store/product/$1/$2';  
$route['product_detail/(:any)'] = 'store/prod_detail/$1';   
$route['statue_detail/(:any)'] = 'store/statue_detail/$1';   
$route['statues'] = 'store/statues';
$route['aboutus'] = 'store/aboutus';  
$route['product'] = 'admin/product';
//$route['product'] = 'store/product';
$route['customer_profile'] = 'store/customer_profile';
$route['gallery'] = 'store/gallery';
$route['contactus'] = 'store/contactus';
$route['event'] = 'store/event';
$route['landingpage'] = 'store/landingpage';
$route['place_order'] = 'store/place_order';
$route['blogs'] = 'store/blogs';
$route['concept'] = 'store/concept';
$route['disclaimer'] = 'store/disclaimer';
$route['concept'] = 'store/concept';
$route['policies'] = 'store/policies';
$route['termcondition'] = '/store/termcondition';
$route['logout1'] = 'store/logout';
$route['blogdetail'] = 'store/blogdetail';   
$route['logout'] = 'site/logout'; 
$route['translate_uri_dashes'] = FALSE;

当我尝试在本地主机上登录时,我总是收到错误消息

An Error Was Encountered

Requested function not found : index

this is the directory structure

任何可以提供任何方向的帮助将不胜感激。

0 个答案:

没有答案