Heim >php教程 >php手册 >PHP获取文件拓展名的几种方式

PHP获取文件拓展名的几种方式

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 19:57:131434Durchsuche

文件名: test.php 获取拓展名(php)的方法: 1.strrchr($filename, .); 2.substr($filename, strrpos($filename, .)) 3.array_pop(explode(., $filename)); 4.$p = pathinfo($filename); echo $p[extension]; 参考: 1.http://www.phpddt.com/php/761.html 2.

文件名: test.php

获取拓展名(php)的方法:


 1.strrchr($filename, '.');
 2.substr($filename, strrpos($filename, '.'))
 3.array_pop(explode('.', $filename));
 4.$p = pathinfo($filename);
   echo $p['extension'];

参考:

1. http://www.phpddt.com/php/761.html

2. http://www.phpddt.com/php/php-sina-test.html

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn