[CI] 폴더 경로, 실행 순서

Grace Goh·2023년 3월 23일
0

PHP

목록 보기
3/19

C: / xampp / apache / conf / extra / httpd-vhosts.conf
파일을 열어서 다음과 같이 추가한다.

<VirtualHost *:80> # 포트 번호
    ServerAdmin webmaster@test.ci.com
    DocumentRoot "C:/xampp/htdocs/ci_0323" # 경로의 폴더가 실행된다.
    ServerName test.ci.com # 입력하면 
    ErrorLog "logs/test.ci.com-error.log"
    CustomLog "logs/test.ci.com-access.log" common
</VirtualHost>

아파치 서버를 stop 후 재시작하면 localhost에서 CodeIgniter 화면을 확인할 수 있다.



디폴트 실행 순서

  1. routes에 디폴트 컨트롤러를 설정한다.
  # app/config/routes.php

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

  $route['default_controller'] = 'welcome'; // 가 기본 컨트롤러로 설정돼 있다.
  $route['404_override'] = '';
  $route['translate_uri_dashes'] = FALSE;

  1. 컨트롤러가 뷰를 실행한다.
# controllers/welcome_message.php

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

class Welcome extends CI_Controller {

	public function index()
	{
		$this->load->view('welcome_message');
	}
}
profile
Español, Inglés, Coreano y Python

0개의 댓글