ctype_print()在 PHP 中,让(或者这是不可能的?)使用 UTF-8 的最佳方法是什么?目前,当我将它与某些 UTF-8 字符一起使用时,它会失败,例如:
ctype_print("Cura\xc3\xa7ao");\nRun Code Online (Sandbox Code Playgroud)\n\n(在荷兰独立岛Cura\xc3\xa7ao之后)返回false。
预先感谢您的时间和帮助。
\n这些ctype_print函数仅使用 ASCII 符号:
使用正则表达式
function ctype_print_utf(string $string): bool
{
return preg_match('/[[:cntrl:]]/', $string) === 0;
}
Run Code Online (Sandbox Code Playgroud)