AFAIK您需要安装阿拉伯语语言包./mage install- 请参阅http://www.magentocommerce.com/magento-connect/Ahmed+J.+Hadi/extension/353/magento-community-modules--arabic-saudi-arabia-语言包
为了让 PHP 接受阿拉伯数字或波斯数字(波斯语)(\xd9\xa1\xd9\xa2\xd9\xa3\xd9\xa4\xd9\xa5),\n我开发了这个简单的函数:
\n\n<?php\n\n/*\n/////////////////////\nThis function has been created by Abdulfattah alhazmi\nRoles:\nTo convert Arabic/Farsi Numbers (\xd9\xa0\xe2\x80\x8e - \xd9\xa1\xe2\x80\x8e - \xd9\xa2\xe2\x80\x8e - \xd9\xa3\xe2\x80\x8e - \xd9\xa4\xe2\x80\x8e - \xd9\xa5\xe2\x80\x8e - \xd9\xa6\xe2\x80\x8e - \xd9\xa7\xe2\x80\x8e - \xd9\xa8\xe2\x80\x8e - \xd9\xa9\xe2\x80\x8e) \nTO the corrosponding English numbers (0-1-2-3-4-5-6-7-8-9)\nhttp://hazmi.co.cc\n/////////////////////\n*/\n\nfunction convertArabicNumbers($arabic) {\n $trans = array(\n "٠" => "0",\n "١" => "1",\n "٢" => "2",\n "٣" => "3",\n "٤" => "4",\n "٥" => "5",\n "٦" => "6",\n "٧" => "7",\n "٨" => "8",\n "٩" => "9",\n );\n return strtr($arabic, $trans);\n}\n?>\nRun Code Online (Sandbox Code Playgroud)\n\n注意:要从表单中的文本字段获取正确的结果,您必须使用该htmlspecialchars_decode()函数。例如:
$mytext = htmlspecialchars_decode($_POST[\'mytext\']));\n$mytext = convertArabicNumbers($mytext);\nRun Code Online (Sandbox Code Playgroud)\n\n为了保证您的代码安全,请添加strip_tags(). 例如:
$mytext = strip_tags(htmlspecialchars_decode($_POST[\'mytext\']));\n$mytext = convertArabicNumbers($mytext);\nRun Code Online (Sandbox Code Playgroud)\n\n如果您对此功能还有任何疑问,请随时询问我。
\n| 归档时间: |
|
| 查看次数: |
3240 次 |
| 最近记录: |