Home  >  Article  >  Backend Development  >  php fnmatch 文件名匹配模式_PHP教程

php fnmatch 文件名匹配模式_PHP教程

WBOY
WBOYOriginal
2016-07-20 11:01:121097browse

php fnmatch 文件名匹配模式  

fnmatch
( PHP 4中“ = 4.3.0 , PHP 5中)

fnmatch -对一个文件名匹配模式

描述
布尔fnmatch (字符串$模式,字符串$字符串[摘要$国旗= 0 ] )
fnmatch ( )检查,如果将通过字符串匹配给定的壳牌通配符模式。

参数

模式
在shell通配符模式。

字符串
测试字符串。这个功能是特别有用的文件名,但也可用于普通字符串。

一般使用者可以用来壳牌模式,或者至少在其最简单的形式,以' ? '和' * '通配符如此使用fnmatch ( ) ,而不是preg_match ( )的前端输入搜索表达方式可能会更方便的非编程的用户。

旗帜
一个FNM_XXX常数。


返回值
返回TRUE如果有比赛,假以其他方式。

修改

版本说明
5.3.0这一功能现在可以在Windows平台上。


实例

例如# 1检查颜色名称对一个shell通配符模式

if (fnmatch("*gr[ae]y", $color)) {
  echo "some form of gray ...";
}
?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445465.htmlTechArticlephp fnmatch 文件名匹配模式 fnmatch ( PHP 4中 = 4.3.0 , PHP 5中) fnmatch -对一个文件名匹配模式 描述 布尔fnmatch (字符串$模式,字符串$字符串...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn