久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網
      最全最豐富的資訊網站

      php獲取文件后綴名有哪些函數

      php獲取文件后綴名有哪些函數

      php實現文件上傳以及多文件上傳是比較重要且必需要掌握的一部分內容,關于文件上傳的方法有很多,這里主要介紹其中的幾種方法,以供大家參考。

      1、字符串查找分割方法

      1.$file = 'x.y.z.png'; echo substr(strrchr($file, '.'), 1);

      解析:strrchr($file, ‘.’)
      strrchr() 函數查找字符串在另一個字符串中最后一次出現的位置,并返回從該位置到字符串結尾的所有字符

      2.$file = 'x.y.z.png'; echo substr($file, strrpos($file, '.')+1);

      解析:strrpos($file, ‘.’)
      查找 “.” 在字符串中最后一次出現的位置,返回位置 substr()從該位置開始截取

      2、數組分割方法

      3.$file = 'x.y.z.png'; $arr=explode('.', $file); echo $arr[count($arr)-1]; 4.$file = 'x.y.z.png'; $arr=explode('.', $file); echo end($arr);   5.$file = 'x.y.z.png'; echo strrev(explode('.', strrev($file))[0]);

      解析:end()返回數組的最后一個元素,strrev(string) 函數反轉字符串。

      3、路徑函數方法

      6.$file = 'x.y.z.png'; echo pathinfo($file)['extension']; //參數如下 [dirname] [basename] [extension] 7.$file = 'x.y.z.png'; echo pathinfo($file, PATHINFO_EXTENSION);

      解析:pathinfo() 函數以數組的形式返回文件路徑的信息。

      以上總共介紹了7種獲取文件后綴名的方法,僅供大家參考,想了解

      贊(0)
      分享到: 更多 (0)
      網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號