找不到404页面未找到您请求的页面.- CodeIgniter

时间:2013-01-16 01:13:16

标签: php mysql codeigniter

你好我们尝试使用CodeIgniter 1.7.1我已经完成了步骤安装  但它显示错误 404页面未找到 找不到您请求的页面。

这是我使用的代码

controller home.php

class Home extends Controller {
       function __construct()
       {
        parent:: __construct();
        //$this->output->enable_profiler();
        $this->load->library('DX_Auth'); 

    } 

模型homemodel.php

class HomeModel extends Model {


    function __construct()
    {
        // Call the Model constructor
        parent::Model();

    }

的.htaccess

RewriteCond $1 !^(index\.php|assets|xcache|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 

我使用localhost“XAMPP”

请帮帮我

和主要index.php

<?php

    error_reporting(E_ALL);

    $system_folder = "system";


    $application_folder = "application";


if (strpos($system_folder, '/') === FALSE)
{
    if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
    {
        $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
    }
}
else
{
    // Swap directory separators to Unix style for consistency
    $system_folder = str_replace("\\", "/", $system_folder); 
}


define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');

if (is_dir($application_folder))
{
    define('APPPATH', $application_folder.'/');
}
else
{
    if ($application_folder == '')
    {
        $application_folder = 'application';
    }

    define('APPPATH', BASEPATH.$application_folder.'/');
}

/*
|---------------------------------------------------------------
| LOAD THE FRONT CONTROLLER
|---------------------------------------------------------------
|
| And away we go...
|
*/
require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;

/* End of file index.php */
/* Location: ./index.php */

服务器错误致命错误:第21行/hermes/bosoraweb075/b2180/ipg.djsaifnycom/paly/system/application/controllers/home.php中找不到“Memcache”类

function index()
{
    $data['memcache'] = new Memcache;
    $data['memcache']->pconnect('localhost', 11211) or $memcache = false;
    //$this->output->cache(60);
    $this->load->model('dx_auth/UserModel', 'user');
    $this->load->model('homemodel');
    $data['title'] = "Home";

    if($this->dx_auth->is_logged_in())
    {
        $query = $this->user->get_user_by_id($this->session->userdata('DX_user_id'));
        //now we get personalized

        $row = $query->row();
        $data['feedFilter'] = $row->feed_filter;
        $data['feedView'] = $row->feed_view;
        if($data['feedFilter'] == 'tagged')
        {
            $data['feedList'] = null;
            $data['feedList'] = $data['memcache']->get('feed' . $data['feedFilter'] . $row->feed_view);
            if($data['feedList'] == null)
            {           
                $data['albums'] = $this->homemodel->getTagged();
            }
        } else {
            $data['feedList'] = null;
            $data['feedList'] = $data['memcache']->get('feed' . $data['feedFilter'] . $row->feed_view);
            if($data['feedList'] == null)
            {
                $data['albums'] = $this->homemodel->getFeedNoUser();
            }
        }
        //$this->output->enable_profiler();
        $this->template->write('title', 'Home');
        $this->template->write_view('content', 'home/index', $data, TRUE);
        $this->template->render();


    } else {
        $data['feedFilter'] = 'all';
        $this->load->helper('cookie');
        if(get_cookie('unravel_feedView'))
        {
            $data['feedView'] = 0;
        } else {
            $data['feedView'] = 1;
        }

        //this would be generic feed here
        $data['feedList'] = null;
        $data['feedList'] = $data['memcache']->get('feed' . $data['feedFilter'] . $data['feedView']);
        if($data['feedList'] == null)
        {
            $data['albums'] = $this->homemodel->getFeedNoUser();
        }
        $this->template->write('title', 'Home');
        $this->template->write_view('content', 'home/index', $data, TRUE);
        $this->template->render();
    }



    //$this->load->view('home/index', $data);
    //$this->output->enable_profiler(TRUE);
}

该行 $ data ['memcache'] =新的Memcache;

2 个答案:

答案 0 :(得分:0)

也许.htaccess不在正确的目录中..你可能想检查它,应该在你的项目目录中。如果是的话,

将此内容放入.htaccess文件

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

答案 1 :(得分:0)

您可能还想检查httpd.conf文件,看看是否允许apache“兑现”.htaccess文件。搜索AllowOverride命令并将其从AllowOverride None(默认值)更改为AllowOverride All

ALSO:之后不要忘记重启httpd服务器。