본문으로 바로가기

[XAMPP] auto_prepend_file, auto_append_file

category Helloworld!/XAMPP 2016. 5. 3. 14:42
php.ini 에 auto_prepend_file, auto_append_file 이라는 설정이 있다.
이 둘은 includerequeird와 같은 기능을 하지만 php 소스 내에 include를 따로 선언하지 않아도 추가없이 include를 한다.
- auto_prepend_file : php 파일이 실행되기 전에 실행할 파일을 지정한다. 모든 php 에서 최상단에 특정 내용을 보여줄 때 유용하다.
                            값이 존재하지 않으면 disable 된다.
- auto_append_file : php 파일이 실행된 후에 실행할 파일을 지정한다. auto_prepend_file 반대로 모든 php 에서 
                           최하단에 특적 내용을 보여줄 때 유용하다.
                           단, auto_append_file은 최하단에 보여지므로 php 파일 중간에 exit(); 가 실행되는 경우 disable이 되며
                           값이 존재하지 않아도 disable이 된다.

php.ini 에서 설정할 경우
auto_append_file = 파일경로
auto_prepend_file = 파일경로
http.confd 에서 설정할 경우
<VirtualHost *>
DocumnetRoot /www/
ServerName localhost
php_value auto_prepend_file 파일경로
</VirtualHost>
참고사이트 : http://qqiwan.blog.me/100062643064