如何在保存文件名的同時抓取其擴展名? 我爆炸字符串以獲取文件擴展名,但文件名內的所有點也消失。我的代碼遺址文件名
$description = '';
$file = "Another Magazine. photos by joe smith. girl_brunette_headband.jpg";
$file = explode('.',$file);
$extension = end($file);
$num_rows = count($file);
$j=0;
while($j<=$num_rows){
$description .= $file[$j];
$description = preg_replace("/$extension/", '', $description);
$j++;
}
echo $description;// outputs: Another Magazine photos by joe smith girl_brunette_headband
我想要的輸出是:另一個雜誌。照片由喬史密斯。 girl_brunette_headband
另一個需要考慮的案例是:'gift.gif'。用你當前的代碼,它會返回't'。 – icktoofay 2012-02-26 02:11:30
它不是爆炸遺址文件名,你知道。 – 2012-02-26 02:19:09
如果沒有爆炸,那麼什麼是刪除點? – 2012-02-26 02:34:22