84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
╰つ ゛思 绪 万 千 , 不 如 努 力 向 前 .ヽ
Get file extension in PHP? -PHP Chinese website Q&A-Get file extension in PHP? -PHP Chinese website Q&A
Please watch and learn.
第1种方法:function get_extension($file){ substr(strrchr($file, '.'), 1);}第2种方法:function get_extension($file){ return substr($file, strrpos($file, '.')+1);}第3种方法:function get_extension($file){ return end(explode('.', $file));}第4种方法:function get_extension($file){ $info = pathinfo($file); return $info['extension'];}第5种方法:function get_extension($file){ return pathinfo($file, PATHINFO_EXTENSION);}
Get file extension in PHP? -PHP Chinese website Q&A-Get file extension in PHP? -PHP Chinese website Q&A
Please watch and learn.
第1种方法:
function get_extension($file){
substr(strrchr($file, '.'), 1);
}
第2种方法:
function get_extension($file){
return substr($file, strrpos($file, '.')+1);
}
第3种方法:
function get_extension($file){
return end(explode('.', $file));
}
第4种方法:
function get_extension($file){
$info = pathinfo($file);
return $info['extension'];
}
第5种方法:
function get_extension($file){
return pathinfo($file, PATHINFO_EXTENSION);
}