PHP:允许字母,数字和阿拉伯字符
作者:互联网
我如何在preg_match中允许使用阿拉伯字符?
if(!preg_match("/^[a-zA-Z0-9]+$/", "لحمدلله")) {
echo "Firstname can only use letters, numbers and arabic characters.";
}
解决方法:
您可以使用此:
if(!preg_match("/^[\p{Arabic}a-zA-Z0-9]+$/u", "لحمدلله")) {
echo "Firstname can only use letters, numbers and arabic characters.";
}
标签:arabic,php 来源: https://codeday.me/bug/20191111/2020706.html