404页未找到您请求的页面没有被发现。 code点火器 [英] 404 Page Not Found The page you requested was not found. Code igniter

查看:419
本文介绍了404页未找到您请求的页面没有被发现。 code点火器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了code点火器的Web应用程序。这是我第一次工作的code-点火器..开发在我的本地Web应用程序。所以,我决定把我的$后临时免费服务器上的C $ C-点火器的Web应用程序..所以我上传我的网站在这个网站 1freehosting ......然后我输入我的数据库..之后,我已经改变数据库的设置数据库。 PHP文件..而且我改变基本URL的config.php文件..as这是我的域名的http:// hello.hostingsiteforfree.com/ ...所以我改成了这个网址..但后来我得到一个下面的错误...我不知道什么错误..我搜索了很多,但没有什么帮助..而且我忘了提,我的.htaccess文件是空的..means没有在一个单一的行

这是错误我收到

  404找不到网页

未找到您所请求的页面。
 

routes.php文件

 < PHP的,如果(定义(BASEPATH')!)出口('没有直接的脚本允许访问);

 $路线['default_controller'] =的LoginController;
$路线['404_override'] ='';


 / *位置:./application/config/routes.php * /
 

我的控制器

 < PHP的,如果(定义(BASEPATH')!)出口('没有直接的脚本允许访问);
 

类的LoginController扩展是CI_Controller {

 功能指数(){

    $新['main_content'] ='loginView';
    $这个 - >负载>查看('loginTemplate /模板',$新);

}




传播verifyUser(){

    //获取从视图参数
    $数据=阵列(
            用户名=> $这个 - >输入 - >后期(用户名),
            '密码'=> $这个 - >输入 - >后期('密码')
    );


    $这个 - >负载>模型('loginModel');
    $查询= $这个 - > loginModel->验证($的数据);


          如果($查询){//如果用户C验证
        //数据变量创建becx我们希望把用户名会话
            $数据=阵列(
                用户名=> $这个 - >输入 - >后期(用户名),
                 is_logged_in'=>真正
            );

           $这个 - >会话级> set_userdata($的数据);
         重定向('sessionController / dashboard_area');
    }
    其他
     {
        $这个 - >指数();
    }
}
函数退出()
{
    $这个 - >会话级> sess_destroy();
    $这个 - >指数();
}
}



?>
 

配置文件

  $配置['BASE_URL'] ='http://hello.hostingsiteforfree.com/';
   $配置['index_page'] ='的index.php';
 

解决方案

既然你没有任何的.htaccess以编辑URL,则必须添加的index.php 调用像一个控制器时,

http://hello.hostingsiteforfree.com/index.php/loginController

我试图通过上面的链接访问它和它的作品,但数据库连接设置不正确

在您的配置文件,其中有 $配置['index_page'] =''如果是空白的添加的index.php

检查,看看它的工作原理

i have developed a web app on code igniter .. this is the first time i am working on code-igniter .. after developing a web application on my localhost .so i decided to put my code-igniter web app on the temporary free server.. so i uploaded my site on this site 1freehosting... and then i imported my database .. after that i have changed the settings of database in database.php file .. and also i changed the base url in config.php file ..as this is my domain name http://hello.hostingsiteforfree.com/... so i changed it to this url .. but then i am getting a following error ... i dont know what is going wrong ..i have searched a lot but nothing helps.. and also i am forgot to mention that my .htaccess file is empty ..means there is not a single line in it

this is the error i am getting

404 Page Not Found

The page you requested was not found.

routes.php

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

 $route['default_controller'] = "loginController";
$route['404_override'] = '';


 /* Location: ./application/config/routes.php */

my controller

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

class LoginController extends CI_Controller {

 function index(){

    $new['main_content'] = 'loginView';
    $this->load->view('loginTemplate/template', $new); 

}




function verifyUser(){

    //getting parameters from view 
    $data = array(
            'username' => $this->input->post('username'),
            'password' => $this->input->post('password')
    );


    $this->load->model('loginModel'); 
    $query = $this->loginModel->validate($data);


          if ($query){             //if the user c validated
        //data variable is created becx we want to put username in session
            $data = array(
                'username' => $this->input->post('username'),
                 'is_logged_in' => true 
            );

           $this->session->set_userdata($data);
         redirect('sessionController/dashboard_area');
    }
    else
     {
        $this->index();
    }
}
function logout()
{
    $this->session->sess_destroy();
    $this->index();
}
}



?>

config file

   $config['base_url']  = 'http://hello.hostingsiteforfree.com/';
   $config['index_page'] = 'index.php';

解决方案

Since you do not have any .htaccess to edit you url you must add an index.php when calling a controller like

http://hello.hostingsiteforfree.com/index.php/loginController

I tried accessing it via the url above and it works, but the database connection is not set up properly

in your config file where there is $config['index_page'] = '' if it is blank add an index.php to it

Check to see it works

这篇关于404页未找到您请求的页面没有被发现。 code点火器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆