久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      太簡(jiǎn)單了!PHP獲取文件擴(kuò)展名的7中方法

      太簡(jiǎn)單了!PHP獲取文件擴(kuò)展名的7中方法

      PHP中獲取文件擴(kuò)展名的方法

      第一種:

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

      解析:strrchr($file, '.')

      strrchr() 函數(shù)查找字符串在另一個(gè)字符串中最后一次出現(xiàn)的位置,并返回從該位置到字符串結(jié)尾的所有字符

      第二種:

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

      解析:strrpos($file, '.')

      查找 "." 在字符串中最后一次出現(xiàn)的位置,返回位置 substr()從該位置開始截取

      第三種:

      $file = 'x.y.z.png'; $arr = explode('.', $file); echo $arr[count($arr)-1];

      第四種:

      $file = 'x.y.z.png'; $arr = explode('.', $file); echo end($arr);  //end()返回?cái)?shù)組的最后一個(gè)元素

      第五種:

      $file = 'x.y.z.png'; echo strrev(explode('.', strrev($file))[0]);

      第六種:

      .$file = 'x.y.z.png'; echo pathinfo($file)['extension'];

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

      包括以下的數(shù)組元素:

      [dirname] [basename] [extension]

      第七種:

      .$file = 'x.y.z.png'; echo pathinfo($file, PATHINFO_EXTENSION)

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