fonction fnmatch PHP ()
Définition et utilisation
fonction fnmatch () pour correspondre au modèle de nom ou d'un fichier chaîne spécifiée.
grammaire
fnmatch(pattern,string,flags)
参数 | 描述 |
---|---|
pattern | 必需。规定要检索的模式。 |
string | 必需。规定要检查的字符串或文件。 |
flags | 可选。 |
Trucs et astuces
Remarque: Cette fonction est disponible sur les plateformes Windows.
Exemples
Selon motif shell générique pour vérifier le nom de la couleur:
<?php
$txt = "My car is darkgrey..."
if (fnmatch("*gr[ae]y",$txt))
{
echo "some form of gray ...";
}
?>
$txt = "My car is darkgrey..."
if (fnmatch("*gr[ae]y",$txt))
{
echo "some form of gray ...";
}
?>
Remplissez Manuel PHP Référence Filesystem