欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          php獲取url擴(kuò)展名的幾種方法是什么

          獲取方法:1、用“substr(strrchr($url,"."),1)”語句;2、用“substr($url,strrpos($url,'.')+1)”語句;3、用“pathinfo($url,PATHINFO_EXTENSION)”。

          php獲取url擴(kuò)展名的幾種方法是什么

          本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版、DELL G3電腦

          php獲取url擴(kuò)展名的方法

          方法1:

          <?php $url="http://localhost/user/order.php"; function get_ext1($url){ 	return substr(strrchr($url,"."),1); } echo get_ext1($url); ?>

          php獲取url擴(kuò)展名的幾種方法是什么

          方法2:

          <?php $url="http://localhost/user/order.php"; function get_ext2($url){ 	$p=pathinfo($url);//Array ( [dirname] => http://localhost/user [basename] => order.php [extension] => php [filename] => order ) 	return $p['extension']; } echo get_ext2($url); ?>

          方法3:

          <?php $url="http://localhost/user/order.php"; function get_ext3($url){ 	return substr($url,strrpos($url,'.')+1); } echo get_ext3($url); ?>

          方法4:

          <?php $url="http://localhost/user/order.php"; function get_ext4($url){ 	$arr=explode('.',$url); 	return array_pop($arr); } echo get_ext4($url); ?>

          方法5:

          <?php $url="http://localhost/user/order.php"; function get_ext5($url){ 	return pathinfo($url,PATHINFO_EXTENSION); } echo get_ext5($url); ?>

          推薦學(xué)習(xí):《PHP視頻教程》

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