如何检查特殊字符的PHP [英] how to check for special characters php
本文介绍了如何检查特殊字符的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
preg_match php特殊字符
Possible Duplicate:
preg_match php special characters
大家好,我想使用preg_match
检查这些字符是否存在于字符串中:
Hi all, I want to check if these characters exist in a string by using preg_match
:
^'£$%^&*()}{@'#~?><>,@|\-=-_+-¬'
请帮助!
推荐答案
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}
这篇关于如何检查特殊字符的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文