1)index.php파일 소스
-이파일은 특정한 기능은 하지않지만 wp-blog-header.php를 로드한다.
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
2)설명
1)define();->상수 선언
-구문형식:define(name,value,case_insensitive);
case_insensitive값에는 true와 false가 있다.
위의 경우변수명에 값이 없으므로 echo constant("WP_USE_THEMES");실행시 아무값도
출력되지 않는다.
-출력할경우:echo constant("WP_USE_THEMES");
-특징
- A constant's value cannot be changed after it is set
- (constant(상수)값은 셋팅된 이후 바뀔 수 없다.)
- Constant names do not need a leading dollar sign ($)
- (constant이름은 $(달러사인)이 필요없다.)
- Constants can be accessed regardless of scope
- (constant는 범위에 관계없이 접근할 수 있다.)
- Constant values can only be strings and numbers
- (constan값은 문자와 숫자만 사용가능 합니다.)
2)requre(); ->파일삽입함수
require "파일이름";함수는 include "파일이름";함수와 동일한 기능을 한다
즉 다른파일을 해당파일에 소스를 삽입하는 역할을 한다.
하지만 include는 파일이름이 존재하지 않을 경우 그냥 파일을 실행하나 require함수는 파일이 존재하지 않을 경우 그부분에서 실행을 멈춘다.
3)dirname();->디렉토리경로 리턴함수
dirname(path)형태로 사용하며 해당파일 위치에서 디렉토리 이름을 리턴(알려준다)한다
dirname( __FILE__ )인경우 현재 위치한파일의 디렉토리 이름을 리턴한다.