用PHP取得文件后缀名的两个办法

Filed under: PHP&MySQL |
Posted on

1、pathinfo函数:

  1. <?php
  2. $name = 'http://www.wangchong.org/ad_banner-1199957657.gif';
  3. $path_parts = pathinfo($name);
  4. echo $path_parts['extension'];
  5. ?>

2、end函数:

  1. <?php
  2. $name = 'http://www.wangchong.org/ad_banner-1199957657.gif';
  3. echo(end(explode(".",$name)));
  4. ?>
Tags : ,   阅读次数: 17

One Response to “用PHP取得文件后缀名的两个办法”

  1. wow gold

    We have been an ebay power seller and paypal confirmed seller of wow gold for years.

Leave a Reply

You must be logged in to post a comment.