PHP 检查字符或者字符串 是否仅包含指定类型的字符 ctype 系列函数
$strings = array('AbCd1zyZ9', 'foo!#$bar'); foreach ($strings as $testcase) { if (ctype_alnum($testcase)) { echo "The string $testcase consists of all letters or digits.\n"; } else { echo "The string $testcase does not consist of all letters or digits.\n"; } }
上面只是一个列子,更多请自行查阅
本博客只是记录个人学习中遇到的问题.供参考学习!

浙公网安备 33010602011771号