主页未在codeigniter中打开

问题描述 投票:0回答:1

主页在codeigniter没有响应我配置正确,我试图调试,但无法找到什么是错误

请看下面的代码

配置/ routes.php文件

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$route['default_controller'] = 'home';
//$route['404_override'] = '';
//this for the admininstration console
$route['admin'] = 'admin/dashboard';
$route['admin/media/(:any)']= 'admin/media/$1';

控制器/ home.php

<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Home extends CI_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->library('form_validation');
                $this->load->model('Category_model');
                $this->load->model('Product_model');
                $this->load->model('Option_model');
                $this->load->model('ratenreview_model');

                //load Dentkart library
                $this->load->library('Banners');
                $this->load->library('Menus');
                $this->load->model(array('location_model'));
                $this->load->model('Customer_model');
        $this->load->model('Testimonial_model');
       $this->load->library('dentkart');
                $this->load->helper(array('formatting_helper'));
                $this->customer = $this->dentkart->customer();

    }
private function index() {

                $this->data['page'] = "Home";
                $this->ratenreview_model->ecash_event_date('dob');
                $this->ratenreview_model->ecash_event_date('clinic_anniversary');
                $this->ratenreview_model->ecash_event_date('marrg_aniversary');

                $arrCatHome  =array(440,468,472,568);
                for($i=0;$i<count($arrCatHome);$i++){

                        $data['arrCategories'][] = $this->Category_model->get_category($arrCatHome[$i]);
                        $data['products'][$arrCatHome[$i]] = $this->Product_model->get_homepage_category_products($arrCatHome[$i]);

                        foreach ($data['products'][$arrCatHome[$i]] as &$p){
                                $p->images  = (array)json_decode($p->images);
                                $p->options = $this->Option_model->get_product_options($p->id);
                        }
                }

                $data['arrShopByBrand'] = $this->Product_model->get_shop_brands();
                //$data['arrHomeProducts'] = $this->Product_model->getHomeProducts();
                //get all booktype
        //$data['arrBooktype'] = $this->Product_model->get_book_types();

        $data['arrTestimonial'] = $this->Testimonial_model->getTestimonialList();
        $this->load->view('vwHome',$data);
    }
}

的.htaccess

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L]

并尝试更改路由器中的默认控制器,它得到404错误请帮我解决问题

php codeigniter mysqli configuration
1个回答
0
投票

private function index() {应该是public function index() {

路由器无法查看/显示私有方法。控制器中的私有方法应该很少使用,通常只用于常用类的较小“辅助”函数。

© www.soinside.com 2019 - 2024. All rights reserved.