CI 묻고 답하기

제목 소스를 올려 달라고 하셔서 올리겠습니다
글쓴이 M군 작성시각 2012/09/26 16:47:38
댓글 : 4 추천 : 0 스크랩 : 0 조회수 : 18804   RSS
1.controller(helloworld.php)

 <?php
class Helloworld extends CI_Controller {
public function index()
{
 
$this->load->model('helloworld_model');
 
$data['result'] = $this->helloworld_model->getData();
$data['page_title'] = "CI Hello World App!";
 
$this->load->view('helloworld_view',$data);
 
}
}
?>

2. model(helloworld_model.php)

<?php
class Helloworld_model extends CI_Model {
 
function __helloworld_model()
{
parent::__helloworld_model();
}
 
function getData()
{
$query = $this->db->get('TB_UserInfo');
 
if ($query->num_rows() > 0)
{
return $query->result();
}else{
show_error('Database is empty!');
}
}
}
?>

3. view(helloworld_view.php)

<html>
<head>
<title><?php echo $page_title?></title>
</head>
<body>
<?php foreach($result as $row):?>
<h3><?php echo $row->UI_Seq?></h3>
<p><?php echo $row->UI_Name?></p>
<br />
<?php endforeach;?>
</body>
</html>

이 상황이고 아래 댓글로 달아놧지만 

routes.php에서 

$route['default_controller'] = "welcome"; 를 $route['default_controller'] = "helloworld"; 로 바꾸면 

http://111.111.111/index.php를 호출하면 정상 출력이 됩니다.

그런데  http://111.111.111/index.php/helloworld 나  http://111.111.111/index.php/helloworld/index 를 호출하면

404가 발생을 하며 혹시나해서 controller에 blog를 생성해서 예제를 그대로 붙여넣기했는데 역시 404가 발생했습니다.ㅠ

도와주세요~ㅠ
 
 다음글 마냐님 공개보드 질문인데요. (2)
 이전글 nginx 연동 질문입니다. (3)

댓글

한대승(불의회상) / 2012/09/26 16:51:49 / 추천 0
소스는 아무런 에러가 없네요.
nginx 설정을 살펴 보셔야 할듯.. 
M군 / 2012/09/26 17:49:24 / 추천 0
 nginx 부분이 문제라면....어떤부분이 문제인지...만약 nginx에 문제가 있다면 다른페이지도 안나와야 하는데

index.php나 같은 위치에 test.php파일 생성해서 phpinfo를 찍어도 정상적으로 작동을합니다..ㅠㅠ
변종원(웅파) / 2012/09/26 21:28:18 / 추천 0
 ci config에서  $config['uri_protocol']  = "REQUEST_URI"; 이렇게 줘보세요.

http://blog.skateinmars.net/post/2007/09/03/Setup-CodeIgniter-on-Nginx-server-with-fastcgi  참고
M군 / 2012/09/27 13:57:04 / 추천 0
불의회상님, 웅파님 감사합니다. nginx conf랑 ci conf파일 수정하고 정상적으로 작동합니다~좋은하루되세요