zoukankan      html  css  js  c++  java
  • PHP全半角转换函数

    /****
    全半角转换,用strtr非常方便 
    在网站开发中,这个功能也常见.
    
    比如,ecshop里就有,如下
    
    function make_semiangle($str)
    {
        $arr = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4',
                     '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9',
                     'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E',
                     'F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J',
                     'K' => 'K', 'L' => 'L', 'M' => 'M', 'N' => 'N', 'O' => 'O',
                     'P' => 'P', 'Q' => 'Q', 'R' => 'R', 'S' => 'S', 'T' => 'T',
                     'U' => 'U', 'V' => 'V', 'W' => 'W', 'X' => 'X', 'Y' => 'Y',
                     'Z' => 'Z', 'a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd',
                     'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i',
                     'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n',
                     'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's',
                     't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x',
                     'y' => 'y', 'z' => 'z',
                     '(' => '(', ')' => ')', '〔' => '[', '〕' => ']', '【' => '[',
                     '】' => ']', '〖' => '[', '〗' => ']', '“' => '[', '”' => ']',
                     '‘' => '[', '’' => ']', '{' => '{', '}' => '}', '《' => '<',
                     '》' => '>',
                     '%' => '%', '+' => '+', '—' => '-', '-' => '-', '~' => '-',
                     ':' => ':', '。' => '.', '、' => ',', ',' => '.', '、' => '.',
                     ';' => ',', '?' => '?', '!' => '!', '…' => '-', '‖' => '|',
                     '”' => '"', '’' => '`', '‘' => '`', '|' => '|', '〃' => '"',
                     ' ' => ' ');
    
        return strtr($str, $arr);
    }
    
    ****/
  • 相关阅读:
    Apache POI
    关于数据池连接技术
    CentOS下安装MySQL
    CentOS下安装JDK的三种方法
    Java大话设计模式
    vs2010安装svn插件
    IIS中如何建立FTP服务
    .net控件dropdownlist动态绑定数据 ----转
    在ASP.NET项目中使用CKEditor
    常用Java Web 服务器
  • 原文地址:https://www.cnblogs.com/zy2012/p/2789305.html
Copyright © 2011-2022 走看看