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

时间:2022-10-09 14:59:01

Hello guys i try to working on CodeIgniter 1.7.1 i have done step to step installing but its showing Error 404 Page Not Found The page you requested was not found.

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

here is codes i used

这是我用过的代码

controller home.php

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

    } 

Models 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] 

i using localhost "XAMPP"

我使用localhost“XAMPP”

please help me

请帮我

and main index.php

和主要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 */

Server error Fatal error: Class 'Memcache' not found in /hermes/bosoraweb075/b2180/ipg.djsaifnycom/paly/system/application/controllers/home.php on line 21

服务器错误致命错误:第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);
}

the line is $data['memcache'] = new Memcache;

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

2 个解决方案

#1


0  

Maybe the .htaccess is not in the correct directory.. you may want to check it, should be inside your project directory. if so,

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

put this in your .htaccess file

把它放在.htaccess文件中

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

#2


0  

You might want to also check your httpd.conf file and see if apache is allowed to "honor" your .htaccess file. Search for the AllowOverride command and change it from AllowOverride None (the default) to AllowOverride All.

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

ALSO: Do not forget to restart the httpd server afterwards.

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

#1


0  

Maybe the .htaccess is not in the correct directory.. you may want to check it, should be inside your project directory. if so,

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

put this in your .htaccess file

把它放在.htaccess文件中

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

#2


0  

You might want to also check your httpd.conf file and see if apache is allowed to "honor" your .htaccess file. Search for the AllowOverride command and change it from AllowOverride None (the default) to AllowOverride All.

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

ALSO: Do not forget to restart the httpd server afterwards.

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