웹마스터 팁
page_full_width">
레이아웃에 소스추가해서 트래픽보기!
2011.03.07 00:09
<?
ini_set("allow_url_fopen","1"); // 서버 설정에 따라 file() 함수의 사용이 가능하도록... [라인추가]
$throttle = "http://홈주소/throttle-me/";
$file = file($throttle); // 소스를 읽고,
$traffic = sprintf("%0.2fMB",strip_tags($file[43]) / 1024); // 44번 라인을 읽어서 태그를 없애고 MB단위로...배열은 0부터 44-1 = 43
$limit = sprintf("%0.1fMB",strip_tags(eregi_replace("M", "",$file[47]))); // 48번 라인을 읽어서 태그를 없애고 GB단위로...
// 현재트래픽/일일허용트래픽 의 형식으로 나타내자.... ex) 34.85MB/1GB
echo "<p style='background-color: white; border: 1px solid#eee; padding: 10px 0 10px 14px; margin-top: 5px; line-height: 17px; border: 1px solid#eee; text-align: left; font-size: 8pt; color:#777;'>";
echo " 현재 트래픽 : $traffic/$limit</a>";
?>
아래는 적용모습입니다(참고로 저는 파란 비즈프리 웹호스팅 사용중입니다)

댓글 2
-
레몬아
2011.03.21 13:56
이소스만 원하는 위치에 삽입하면 돼는건가요?;.. -
막시민
2011.04.10 00:05
네
다만 해당서버에 throttle-me가 깔려있어야 합니다.