사랑해 만화를 다운로드한 디렉토리에서 가장 최근의 그림을 읽어오는
아주 간단한 스크립트
<?
function lastimage() {
$dir = "/data/사랑해/image";
$d = opendir($dir);
while ($file = readdir($d)) {
$files<> = $file;
}
closedir($d);
rsort($files);
return $files[1];
}
// 이건 그냥 사용 예제
echo("<IMG SRC="http://www.chosun.com/photo/news/".
ereg_replace("^(......).*", "1", lastimage())."/".
lastimage()."">");
?>
lastimage() 라는 함수로 뺐으니까 아무대나 붙이기 쉬우실 꺼에요.
예제 테스트는 http://linux.sarang.net/~redhands/sarang.php3 (언제 지울지 모릅니다.)
--
아.지.사.바