您现在的位置是:首页 > 后端 > PHP PHP
PHP中判断字符串是否含有中文
2022-08-23【PHP】598人已围观
简介## 判断全是中文 > 方法一 ``` $str = '吾爱编程'; if (preg_match_all("/^([\x81-\xfe][\x40-\xfe])+$/", $str, $match)) { echo '全部是中文'; } else { echo '不全是中文'; } ``` > 方法二 ``` $str="'吾爱it编程"; if(!eregi("[^\x80-\xff]","$str")){ echo "全是中文";
相关文章
随机图文
bat锁屏和熄屏 windows
bat锁屏和熄屏 windowsPHP中判断字符串是否含有中文
## 判断全是中文 > 方法一 ``` $str = '吾爱编程'; if (preg_match_all("/^([\x81-\xfe][\x40-\xfe])+$/", $str, $match)) { echo '全部是中文'; } else { echo '不全是中文'; } ``` > 方法二 ``` $str="'吾爱it编程"; if(!eregi("[^\x80-\xff]","$str")){ echo "全是中文";PHP日历
PHP日历小案例dedecms Allowed memory size of /include/helpers/string.helper.php
dedecms Allowed memory size of /include/helpers/string.helper.php