Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
也许我问的问题有点太平庸了,但我真的不知道如何使用 PHP 检查字符串中是否出现通配符 (*) 字符。
示例字符串:*bcdOR ab*dORabc*
*bcd
ab*d
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上的示例