我需要在我的网络应用程序中将号码表示更改为“阿拉伯语 - 印度数字”以将123456789显示为“0123456789”。
下面的代码做我需要的但是通过Jquery选择了像span这样的dom元素.BUT我需要更改服务器整个响应的所有数字
// Eastern Arabic (officially "Arabic-Indic digits")
"0123456789".replace(/\d/g, function(v) {
return String.fromCharCode(v.charCodeAt(0) + 0x0630);
}); // "٠١٢٣٤٥٦٧٨٩"
有关我的应用程序的更多信息。
我使用WampServer作为网络服务器,这意味着我希望使用php,jquery,js,css,Apache服务器设置获得解决方案。
答案 0 :(得分:0)
试试这个
function convertArabic($str) {
$standard = array("9", "8", "7", "6", "5", "4", "3", "2", "1", "0");
$east_arabic = array("٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩");
$str = str_replace($standard, $east_arabic, $str);
return $str;
}
传递一个字符串,它将在整个字符串中将数字替换为阿拉伯语