我如何在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.";
}