xvi*_*ilo 5 php string wildcard
是否可以在if语句中使用通配符?
我的代码:
* =通配符
if ($admin =='*@some.text.here') {
}
Run Code Online (Sandbox Code Playgroud)
$admin 将是以下之一:
Wis*_*guy 14
如果您不想使用正则表达式,fnmatch()可能会为此[有限]目的服务.它使用像您期望的类似shell的通配符来匹配字符串.
if (fnmatch('*@some.text.here', $admin)) {
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3889 次 |
| 最近记录: |