我目前正在GREEK项目中工作.在该项目中,所有内容都是GREEK,并且我有搜索功能.搜索过程很好.但是strtoupper()没有将希腊语转换为大写,而strtolower()没有将希腊语转换为小写.
但对于英语而言,它的工作正常.有没有办法将希腊字母转换为UPPER和LOWER案例.
谢谢
FERO
没有理由mb_strtolower()和mb_strtoupper()不应该工作:
<?php
header('Content-Type: text/html; charset=utf-8');
echo mb_strtoupper('????????????????', 'UTF-8'); // ????????????????
echo mb_strtolower('????????????????', 'UTF-8'); // ????????????????
?>
Run Code Online (Sandbox Code Playgroud)
使用mb_convert_case()是另一种选择,特别是如果你想模仿ucwords():
<?php
header('Content-Type: text/html; charset=utf-8');
echo mb_convert_case('????????????????', MB_CASE_UPPER, 'UTF-8'); // ????????????????
echo mb_convert_case('????????????????', MB_CASE_LOWER, 'UTF-8'); // ????????????????
echo mb_convert_case('????????????????', MB_CASE_TITLE, 'UTF-8'); // ????????????????
?>
Run Code Online (Sandbox Code Playgroud)