2012-08-22 6 views
2

저는 CI 프레임 워크를 사용하여 기본 응용 프로그램을 만들고 있습니다.요청한 페이지를 찾을 수 없습니다 - CodeIgniter

404 Page Not Found

The page you requested was not found.

아래에 배치하는 내 코드 파일입니다

나는 다음과 같은 오류가 있습니다.

내 컨트롤러 코드 :

모델에서 다음
class Contact extends CI_Controller{ 

    function _Contact(){ 
    parent::CI_Controller(); 
    } 

    /*function main(){ 
    $this->load->model('contact_model'); 
    $data = $this->books_model->general(); 

    $this->load->view('books_main',$data); 
    }*/ 

    function input(){ 

    $this->load->helper('form'); 
    $this->load->helper('html');  
    $this->load->model('contact_model'); 

    if($this->input->post('mysubmit')==true){ 
     $this->contact_model->entry_insert(); 
    } 

    $data = $this->contact_model->general(); 

    $this->load->view('contact_input',$data); 
    } 

} 

나는 다음과 같은 코드가 마지막으로

class contact_model extends CI_Model{ 

    function _contact_model(){ 
    parent::Model(); 
    $this->load->helper('url');    
    } 

    function entry_insert(){ 
    $this->load->database(); 
    $data = array(
       'name'=>$this->input->post('title'), 
      'address'=>$this->input->post('author'), 

       'year'=>$this->input->post('year'), 

      ); 
    $this->db->insert('contact',$data); 
    } 

    function general(){ 

    $data['base']  = $this->config->item('base_url'); 

    $data['name']  = 'Name'; 
    $data['address']  = 'Address'; 

    $data['year']  = 'Year'; 
    $data['years']  = array('2007'=>'2007', 
           '2008'=>'2008', 
           '2009'=>'2009'); 

    $data['forminput'] = 'Student Registration'; 

    $data['fname']  = array('name'=>'name', 
           'size'=>30 
         ); 
    $data['faddress'] = array('name'=>'address', 
           'size'=>30 
         ); 

    return $data; 
    } 
} 

, 내보기 :

<html> 
<head> 

</head> 
<body> 
<div id="header"> 
<?php $this->load->view('contact_header'); ?> 
</div> 

<?php echo heading($forminput,3) ?> 
<?php echo form_open('books/input'); ?> 
<?php echo $name  .' : '. 
     form_input($fname).br(); ?> 
<?php echo $address  .' : '. 
     form_input($faddress).br(); ?> 

<?php echo $year  .' : '. 
     form_dropdown('year',$years).br(); ?> 

<?php echo form_submit('mysubmit','Submit!'); ?> 
<?php echo form_close(); ?> 

<div id="footer"> 
<?php $this->load->view('contact_footer'); ?> 
</div> 

</body> 
</html> 

어느 한 날 도와 주실 수 있습니까? 상대 컨트롤러에서

+2

액세스하려는 URL은 무엇입니까? – Matt

+2

또한'.htaccess'는 어떻게 생겼습니까? – Malachi

+0

일반적으로 CI에서 index() 또는 _remap() 메서드를 사용합니다. 사용자가 누락되어 있으므로 호출하는 url이 필요하지 않습니다. 자세한 정보가 필요합니다. – qwertzman

답변

1

제거이 :

function _Contact(){ 
    parent::CI_Controller(); 
} 

이 교체 :

function _contact_model(){ 
    parent::Model(); 
    $this->load->helper('url');    
} 

이로 교체 : :이 제거

function __construct(){ 
    parent::__construct(); 
} 

을 그리고 상대 모델에

function __construct(){ 
    parent::__construct(); 
    $this->load->helper('url'); 
} 
0

Hey,

I often had similar Problems. Usually I check the following:

  1. Check the Config file if the correct siteroot is set. I often had live server stuff in there.
  2. Check in the .htaccess if the RewriteBase is set to the correct directory.
  3. to make sure its reading the correct value an echo base_url(); (if this works its usually the .htaccess rewrite base).

Hope it helps.

r n8m [enter link description here][1]

[1]: http://ellislab.com/forums/viewthread/105880/

현대차

Windows에서 응용 프로그램을 개발 한 경우
0

, 당신은 자본 문자로 컨트롤러와 모델 이름의 첫 번째 문자를 설정하지 않을 수 있습니다. /controllers/Home.php

리눅스 파일 이름에

에 /controllers/home.php 같은

는 대소 문자를 구분합니다.

참고 : - 가능한 문제의 해결책입니다. 잘못된 구성, 서버 및 경로 변수 문제가있을 수 있습니다.

중복 가능 : CodeIgniter "The page you requested was not found." error?

관련 문제