📜  php 正则表达式文件扩展名 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:05.480000             🧑  作者: Mango

代码示例1
$fileName = 'banner.jpg';

$ext = end(explode('.', $fileName));
$ext = substr(strrchr($fileName, '.'), 1);
$ext = substr($fileName, strrpos($fileName, '.') + 1);
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $fileName);
$ext = pathinfo($fileName, PATHINFO_EXTENSION);