如何獲取(提取)PHP文件擴展名? - How do I get (extract) a file extension in PHP?

問題:

This is a question you can read everywhere on the web with various answers: 這是一個您能夠在網上處處閱讀的各類問題,並有各類答案: web

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

$exts = split("[/\\.]", $filename);
$n    = count($exts)-1;
$ext  = $exts[$n];

etc. 等等 spa

However, there is always "the best way" and it should be on Stack Overflow. 可是,總有「最佳方法」,它應該在堆棧溢出中。 .net


解決方案:

參考一: https://stackoom.com/question/jEK/如何獲取-提取-PHP文件擴展名
參考二: https://oldbug.net/q/jEK/How-do-I-get-extract-a-file-extension-in-PHP
相關文章
相關標籤/搜索