-
1. 부트스트랩 불러오기
require_once 로 bootstrap.php를 부르면
다음과 같이 Dotenv를 이용해서 .env가 있는 경로를 지정하고, load() 한다.
이로서 index.php 내부에서 환경변수를 사용할 수 있다.
2. 변수 불러오기
$_EVN[' 변수명 '] 을 이용해서
.env 파일에 저장된 변수를 불러온다
explode() 를 통해서 ; 를 기준으로 문자열을 배열로 변화시킨다.
'php' 카테고리의 다른 글
php 경로 지정 (0) 2023.08.21 객체지향 프로그램 설계 ( SOLID ) (0) 2023.08.21 스크래퍼 제작하기 (0) 2023.08.17 windows에서 php에 curl 확장 시 주의 (0) 2023.08.10 스크래핑 POST 요청 (0) 2023.08.10