PHP fnmatch() 函数

PHP 教程 · 2019-01-25 06:41:28

定义和用法

fnmatch() 函数根据指定的模式来匹配文件名或字符串。

语法


fnmatch(pattern,string,flags)


参数 描述
pattern 必需。规定要检索的模式。
string 必需。规定要检查的字符串或文件。
flags 可选。

提示和注释

注释:该函数无法在 Windows 平台上使用。

实例

根据 shell 通配符模式来检查颜色名:


<?php
$txt = "My car is darkgrey..."
if (fnmatch("*gr[ae]y",$txt))
  {
  echo "some form of gray ...";
  }
?>


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

The Mechanics of Web Handling

The Mechanics of Web Handling

David R. Roisum

This unique book covers many aspects of web handling for manufacturing, converting, and printing. The book is applicable to any web including paper, film, foil, nonwovens, and textiles. The Mech......一起来看看 《The Mechanics of Web Handling》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具