2014-06-10 02:22
浏览 43

PHP - 用于查找文件的通配符?

I'm trying to make a PHP script to list everything in a directory but I want to exclude certain files ending in desc.txt as they'll take up too much space in the list. (They're there to provide descriptions to the actual script of each folder/file)

if ($file !== "." && $file !== ".." && $file !== "desc.txt"){

That hides the whole "../" button to go up a directory and stuff, but I really can't figure out how to make it hide files ending in desc.txt. I tried * and % and glob and all that other stuff but nothing has worked so I just have it there as desc.txt, any ideas?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doupafu6980 2014-06-10 02:25

    This should work.

    if ($file !== "." && $file !== ".." && substr($file, -8) !== "desc.txt"){ );
    打赏 评论

相关推荐 更多相似问题