如何允许阿拉伯语字符在PriggMatter中?

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.";
}

07-26 09:29