【问题标题】:Seperate file name from path glob() [duplicate]从路径 glob() 中分离文件名 [重复]
【发布时间】:2016-03-25 07:53:06
【问题描述】:

如何只获取文件名而不是路径+文件名?

foreach(glob('./item/*.txt') as $filename){
   echo $filename;
}

【问题讨论】:

    标签: php


    【解决方案1】:

    使用basename($filename) 获取文件的文件名。在此处查看文档:http://php.net/manual/en/function.basename.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-08
      • 1970-01-01
      • 2017-12-13
      • 2018-04-18
      • 2012-12-23
      相关资源
      最近更新 更多