브라우저 캐시로 인해 이미지나 css가 안읽어 지는 경우
0
본문
html이나 css를 수정했음에도 브라우저 캐시로 인해 로딩이 안되는 경우가 있다.
시간이 지나면 자연히 로딩이 되겠지만 성격이 급한 우리 클라이언트들은 기다려 주지 않는다.
이때 filemtime 함수를 사용해 파일변경날짜를 변수로 넣어주면 캐시 문제가 해결된다.
사용방법
[파일명]?v=<?php echo filemtime('[파일경로]'); ?>
예제
default.css?v=<?php echo filemtime('./css/default.css'); ?>
img_logo.png?v=<?php echo filemtime('./img/img_logo.png'); ?>
img_logo.png?v=<?php echo filemtime('./img/img_logo.png'); ?>
댓글목록
등록된 댓글이 없습니다.