¾È³çÇϽʴϱî? php¸¦ ¸· ½ÃÀÛÇÑ Ãʺ¸ÀÔ´Ï´Ù. "php À¥¼¹ö ÇÁ·Î±×·¡¹Ö"À̶ó´Â Ã¥¿¡ ½áÀÖ´Â ´ë·ç ´ÙÀ½Ã³·³ Äڵ带 ÀÛ¼ºÇß½À´Ï´Ù.
<?php $datafile="counter.data"; if(file_exists($datafile)) { $fp=fopen($datafile, 'r'); $buffer=fread($fp, filesize($datafile)); fclose($fp); $count=intval($buffer); } else { $count=0; } $count=$count+1; $fp=fopen($datafile, 'w'); fwrite($fp, $count); fclose($fp);
echo "´ç½ÅÀº $count ¹ø° ¹æ¹®ÇÑ ¼Õ´ÔÀÔ´Ï´Ù."; ?>
ÀÌ·¸°Ô ÀÛ¼ºÇÑ ÆÄÀÏÀ» counter.php4·Î ¸®´ª½º»óÀÇ /var/www/html(¿Í¿ì¸®´ª½º ±îÄ¡7.0)¿¡ ÀúÀåÇÏ°í À¥ºê¶ó¿ìÀú¿¡¼ ½ÇÇà½ÃÄ״µ¥ ´ÙÀ½°ú °°Àº ¿¡·¯°¡ ³µ½À´Ï´Ù.
warning: fopen("counter.data", "w")-permission denied in /var/www/html/counter.php4 on line 19 warning: supplied argument is not a valid file- handle resource in /var/www/html/counter.php4 on line 20 warning: supplied argument is not a valid file- handle resource in /var/www/html/counter.php4 on line 21
Âü°í·Î counter.php4´Â pico·Î ÀÛ¼ºÇß½À´Ï´Ù.
|