获取文件后缀的9种方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 <?php
/**
* Created by PhpStorm.
* User: liuft
* Date: 2016/3/7
* Time: 15:46
*/ //第一种
// function get_extension($file)
// {
// $file = explode('.', $file);
// return end($file);
// }
//第二种 // function get_extension($file)
// {
// return substr(strrchr($file, '.'), 1);
// } //第三种
// function get_extension($file){
// return pathinfo($file)['extension'];
// }
// //第四种
//function get_extension($file)
//{
// return substr($file, strrpos($file, '.') + 1);
//} //第五种
//function get_extension($file)
//{
// $file = preg_split('/\./', $file);
// return end($file);
//} //第六种
// function get_extension($file){
// $file = strrev($file);
// return strrev(substr($file,0,strpos($file,'.')));
// }
// //第七种
// function get_extension($file)
// {
// return pathinfo($file, PATHINFO_EXTENSION);
// }
//
//第八种
// function get_extension($file)
// {
// preg_match_all('/\.[a-zA-Z0-9]+/',$file,$data);
// return !empty($data[0])?substr(end($data[0]),1):'';
// } //第九种
// function get_extension($file){
// return str_replace('.','',strrchr($file,'.'));
// } //暂时想这么多,以后想起来再补充 $file = "http://10.31.63.8:8081/M00/00/09/Ch8_CFaaMLqAO87JAACePvS0ZRk.webp"; $data = get_extension($file); var_export($data);

php获取文件后缀的9种方法的更多相关文章

  1. PHP获取文件后缀的7中方法

    在日常的工作当中我们避免不了要经常获取文件的后缀名,今天我就整理了一下7种获取文件后缀的方法,希望对大家有所帮助. $url = 'http://www.baidu.com/uploads/20185 ...

  2. C# 根据包含文件的路径和文件的名称的字符串获取文件名称的几种方法

    C# 截取带路径的文件名字,扩展名,等等 的几种方法 C#对磁盘IO操作的时候,经常会用到这些,路径,文件,文件名字,文件扩展名. 之前,经常用切割字符串来实现, 可是经常会弄错. 尤其是启始位置,多 ...

  3. Java获取文件Content-Type的四种方法

    HTTP Content-Type在线工具 有时候我们需要获取本地文件的Content-Type,已知 Jdk 自带了三种方式来获取文件类型. 另外还有第三方包 Magic 也提供了API.Magic ...

  4. 关于Java获取文件路径的几种方法

    第一种:File f = new File(this.getClass().getResource("/").getPath()); System.out.println(f);  ...

  5. java项目中获取文件路径的几种方法

    // 第一种: 2 File f = new File(this.getClass().getResource("/").getPath()); // 结果: /Users/adm ...

  6. Java获取文件路径的几种方法

    第一种: File f = new File(this.getClass().getResource("/").getPath()); System.out.println(f); ...

  7. C#获取文件路径的几种方法

    //获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称. string str5=Application.StartupPath;//可获得当前执行的exe的文件名. string str1 ...

  8. android获取文件getMimeType的两种方法

    方法1: import java.util.Locale; private static String getSuffix(File file) { if (file == null || !file ...

  9. php 获取文件后缀最简单的方法

    1 <?php 2 $recordingname = '通话录音@18502290616(18502290616)_20171103142448.mp3'; 3 $suffix = end(ex ...

随机推荐

  1. vue - utils.js

    exports:导出功能函数或变量 module.exports:默认导出{} ------------------------------------------------------------ ...

  2. SSI整合 示例

    sql语句 create table user_c (id varchar(10) primary key,name varchar(20),age int ,address varchar(30); ...

  3. Linux命令-网络命令:last

    last 统计linux系统所有用户的登录时间(多次登录信息)

  4. socket.io(转载)

    socket.io 中文手册,socket.io 中文文档转载于:http://www.cnblogs.com/xiezhengcai/p/3956401.html 服务端 io.on(‘connec ...

  5. 服务器server2008网站iis7+php环境的搭建

    IIS+FastCGI+PHP5_32_Gzip环境搭建-------------------0.装iis71.把php_5.32_win86解压到d:\php2.php.ini文件已经配置好不需要在 ...

  6. atitit。企业组织与软件工程的策略 战略 趋势 原则 attilax 大总结

    atitit.企业组织与软件工程的策略 战略 趋势 原则 attilax 大总结 1. 战略规划,适当的过度设计 1 2. 跨平台化 1 3. 可扩展性高于一切 1 4. 界面html5化 2 5.  ...

  7. [k8s]kubelet最佳实战

    kubelet端口解析: 10250 –port: kubelet服务监听的端口,api会检测他是否存活 10248 –healthz-port: 健康检查服务的端口 10255 –read-only ...

  8. 浅谈iOS 5的StoryBoard

    转自:http://blog.163.com/wangy_0223/blog/static/450146612012318113233218/ 示例代码的Github地址:https://github ...

  9. Oracle VM VirtualBox虚拟机导出教程

    Oracle VM VirtualBox虚拟机导出教程 | 浏览:583 | 更新:2015-01-31 11:21 1 2 3 4 5 6 7 分步阅读 有时我们需要把Oracle VM Virtu ...

  10. [NM 状态机1] Application状态机详解

    概述 前面已经分析了RM的状态机,接下来将分析NM的状态机,NM状态机包括Container,Application,LocalizedResource三个.首先我们分析Application的状态机 ...