|
![](icon/private_name/1.gif) |
13³â Àü |
php¿¡¼ ÆÄÀÏÈ®ÀåÀÚ¸¦ ±¸ÇÏ´Â ¿©·¯°¡Áö ¹æ¹ýÀÔ´Ï´Ù.
<?
$filename = "mypage.asp";
//1 strrchrÇÔ¼ö¸¦ »ç¿ëÇؼ È®ÀåÀÚ ±¸Çϱâ
$ext = substr(strrchr($filename, '.'), 1);
echo$ext;
echo"<br>";
//2 strrpos ÇÔ¼ö¿Í substrÇÔ¼ö¸¦ »ç¿ëÇؼ È®ÀåÀÚ ±¸Çϱâ
$ext = substr($filename, strrpos($filename, '.') + 1);
echo$ext;
echo"<br>";
//3 expload ÇÔ¼ö¿Í end ÇÔ¼ö¸¦ »ç¿ëÇؼ È®ÀåÀÚ ±¸Çϱâ
$ext = end(explode('.', $filename));
echo$ext;
echo"<br>";
//4 preg_replace ÇÔ¼ö¿¡ Á¤±Ô½ÄÀ» ´ëÀÔÇؼ È®ÀåÀÚ ±¸Çϱâ
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);
echo$ext;
echo"<br>";
//5 pathinfo ÇÔ¼ö¸¦ »ç¿ëÇؼ È®ÀåÀÚ ±¸Çϱâ
$fileinfo = pathinfo($filename);
$ext = $fileinfo['extension'];
echo$ext;
?>
|
|
̵̧ : 362 |
̵̧
¸ñ·Ï
|
|