也许我问的问题有点太平庸了,但我真的不知道如何使用 PHP 检查字符串中是否出现通配符 (*) 字符。
示例字符串:*bcd
OR ab*d
OR abc*
无论我尝试使用什么 PHP 函数,它的行为都是不可预测的。我只需要知道通配符是否在字符串中。非常感谢您的回复!
if (strpos($mystring, '*') === false) {
echo "Wildcard was not found in the string '$mystring'";
} else {
echo "Wildcard was found in the string '$mystring'";
}
基于以下示例http://php.net/manual/en/function.strpos.php http://php.net/manual/en/function.strpos.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)