Chinese characters are transformed into pinyin (PHP version)

zhaozj2021-02-16  56

Many problems are because the file names caused by Chinese issues are best not to use Chinese now solving, which is generally generated, making this ID, filename. Now use this conversion, there is a lot of principles: use multidimensional arrays 1. Add index 2. Traverse array

<$ D = array (Array ("Ai", - 20317), Array ("AN", - 20304), Array ("Ang", - 20295), array (" Ao ", - 20292), Array (" BAI ", - 20265), Array (" Ban ", - 20257), Array (" Bang ", - 20242), array (" Bao ", - 20230), Array (" BEN ", - 20036), Array (" Beng ", - 20032), Array (" BI ", - 20026), array (" Array ("BIE", - 19986), Array ("BIE", 19982), Array ("BIE", - 19982), Array ("BING", - 19976), Array (" Array ("CA", - 19774), Array ("CAI", - 19774), Array ("CAI", - 19774), ARRAY ("Cai", - 19763) CANG, - 19756), Array ("CE", - 19746), Array ("CENG", - 19741), Array ("Cha", - 19739), Array (" Chai, - 19728, Array ("CHAN", - 19725, Array ("CHAO", - 19540), Array ("Che", - 19531), array (" ", - 19525), Array (" CHENG ", - 19515), Array (" Chi ", - 19500), Array (" CHONG ", - 19484), Array (" Chou ", - 19479), Array (" CHU, - 19467), Array ("Chuan", - 19288), Array ("Chuang", - 19281), Array ("CHUI", - 19275, ARR AY ("Chun", - 19270), Array ("Ci", - 19261), Array ("CONG", - 19249), Array ("cou", - 19243), Array ("Cu", - 19238), Array ("CUI", - 19235), Array ("Cun", - 19227), Array ("Cuo", - 19224), Array ("Da", - 19218), Array ("DAI", - 19212), Array ("DAN"

, -19038), Array ("DAO", - 19018), Array ("DE", - 19006), Array ("deng", - 19003), Array ("Di" , -18996), Array ("DIAO", - 18961), Array ("Die", - 18952), Array ("DIU", - 18783), Array ("Diu" , -18774), Array ("DOU", - 18763), Array ("DU", - 18756), Array ("Duan", - 18741), Array ("dui" , -18735), Array ("DUO", - 18722), Array ("E", - 18710), Array ("En", - 18697), Array ("ER" , -18696), Array ("Fan", - 18518), Array ("Fang", - 18501), Array ("Fei", - 18490), Array ("FEN" , -18478), Array ("FO", - 18448), Array ("FOU", - 18447), Array ("fu", - 18446), Array ("GA" , -18239), Array ("GAI", - 18231), Array ("Gang", - 18220), Array ("GAO", - 18211), Array ("GE" , -18201), Array ("GEI", - 18183), Array ("GENG", - 18181), Array ("GONG", - 18012), Array ("gou" Array ("Gua", - 17970), Array ("Guai", - 17964), Array ("GUAN", - 17961), ARRAY ("guang" , -17950 Array ("GUI", - 17947), Array ("Guo", - 17928), Array ("Ha", - 17922), Array ("Hai", - 17759 Array ("HAN", - 17752, Array ("HANG", - 17733), Array ("Hao", - 17730), Array ("HE", - 17721), ARRAY ("HEI", Array ("HEN", - 17701), Array ("HENG", - 17697), Array ("hong"

Array ("Hu", - 17496), array ("huai", - 17487), array ("huai", - 17487), array ("huai", - 17487), array ("huan", - 17487) , -17482), Array ("Hui", - 17454), Array ("Hun", - 17433), Array ("Huo", - 17427), Array ("ji" , -17417), Array ("Jian", - 17185), Array ("JIANG", - 16983), Array ("JIAO", - 16970), Array ("jie" , -16942), Array ("JING", - 16733), Array ("Jiong", - 16708), Array ("JIU", - 16706), Array ("JU" , -16689), Array ("JUE", - 16657), Array ("Jun", - 16647), Array ("KA", - 16474), Array ("kai" , -16470), Array ("KANG", - 16459), Array ("Kao", - 16452), Array ("KE", - 16448), Array ("ken" , -16433), Array ("KENG", - 16427), Array ("KOU", - 16423), Array ("KU", - 16419), Array ("KUA" , -16412), Array ("KUAN", - 16403), Array ("Kuang", - 16401), Array ("KUI", - 16393), Array ("kun" , -16220), Array ("la", - 16212), Array ("LAI", - 16205), Array ("LAN", - 16202), array ("la NG ", - 16187), Array (" LAO ", - 16180), Array (" Le ", - 16169), Array (" Leng ", - 16158), Array (" Array ("LIAO", - 15944, ARRAY ("LIAO", - 15944), ARRAY ("LIAO", - 15933), ARRAY ("LIAO", - 15933), ARRAY ("" ", - 15920), Array (" LIN ", - 15915), Array (" Ling ", - 15903), Array ("

Series ("LOU", - 15707), Array ("Lou", - 15707), Array ("Lou", - 15707), Array ("LV", - 15681), ARRAY (" Luan, - 15667), Array ("LUN", - 15659), Array ("Luo", - 15652), Array ("MA", - 15640), array (" Array ("MAN", - 15454), Array ("MAO", - 15448), ARRAY ("MAO", - 15448), ARRAY ("ME", - 15436), ARRAY ("" ARRAY ("MENG", - 15416), Array ("MENG", - 15416), Array ("MI", - 15408), Array ("Mian", - 15394), Array (" ARRAY ("MIN", - 15369), Array ("MIN", - 15369), Array ("MIN", - 15369), ARRAY ("MIU", - 15369), ARRAY ("" Mo ", - 15362), Array (" Mou ", - 15183), Array (" NA ", - 15165), Array (" Nai ", - 15158), array (" Nan ", - 15153), Array (" NAO ", - 15149), Array (" NE ", - 15144), Array (" Nei ", - 15143), Array (" NEN ", - 15141), Array (" NIENG ", - 15140), Array (" NiAN ", - 15128), Array (" Niang ", - 15121), array (" Niao, - 15119), Array ("NIE", - 15117), Array ("NING", - 15109), Array ("NIU", - 14941), Array (" " -14937), Array ("NU", - 14930), Array ("NUAN", - 14929), Array ("Nue", - 14928), Array ("Nuo", -14926), Array ("O", - 14921), Array ("Pa", - 14914), Array ("PAI", - 14908), Array ("PAN", -14902), Array ("PANG", - 14894), Array ("PAO", - 14889), Array ("Pei"

, -14882), Array ("PENG", - 14871), Array ("Pi", - 14857), Array ("Pian", - 14678), Array ("PIAO" , -14674), Array ("PIE", - 14670), Array ("PING", - 14663), Array ("Po", - 14654), Array ("PU" , -14645), Array ("QIA", - 14594), Array ("Qian", - 14429), Array ("Qiang", - 14407), Array ("QIAO" , -14399), Array ("QIN", - 14379), Array ("QING", - 14368), Array ("Qiong", - 14355), Array ("Qiu" , -14353), Array ("Quan", - 14170), Array ("QUE", - 14159), Array ("Qun", - 14151), Array ("RAN" , -14149), Array ("RAO", - 14140), Array ("RE", - 14137), Array ("REN", - 14135), Array ("RENG" , -14125), Array ("ROU", - 14122), Array ("Rou", - 14112), Array ("Ru", - 14109), Array ("Ruan" , -14099), Array ("RUI", - 14097), Array ("Ruo", - 14092), Array ("SA", - 14090), Array ("SAI" , -14087), Array ("SANG", - 13917), Array ("SAO", - 13914), Array ("SE", - 13910), Array ("Sen" ,-1 3907), Array ("SENG", - 13906), Array ("SHA", - 13896), Array ("SHAN", - 13894), Array ("Shang", 13878), Array ("SHAO", - 13870), Array ("SHE", - 13859), Array ("SHEN", - 13847), Array ("SHENG", - 13831), Array ("shi", 13658), Array ("Shou", - 13611), Array ("SHU", - 13601), ARRAY ("

Shua, - 13406), Array ("SHUAI", - 13400), Array ("Shuang", - 13398), Array ("SHUI", - 13395), Array (" SHun, - 13391), Array ("SHUO", - 13387), Array ("Si", - 13383), Array ("Song", - 13367), Array ("Sou", - 13359), array (" Su ", - 13356), Array (" Suan ", - 13343), Array (" SUI ", - 13340), Array (" Suo ", - 13326), array (" Ta ", - 13318), Array (" Tan ", - 13138), Array (" TANG ", - 13120), Array (" tao ", - 13107), array (" TE ", - 13096), Array (" TI ", - 13091), Array (" Tian ", - 13076), Array (" TIAO ", - 13068), Array (" Tie ", - 13063), Array (" Tong ", - 12888), Array (" Tou ", - 12875), Array (" TU ", - 12871), Array (" Array ("TUN", - 12852), Array ("TUN", - 12852), Array ("TUO", - 12849), Array ("Wa", - 12838), Array (" "WAN", - 12829), Array ("Wei", - 12802), Array ("Wei", - 12802), Array ("Wei", - 12802), Array ("Wen", - 12607), Array (" ", - 12597), Array (" Wo ", - 12594), Array (" Xi ", - 12556), Array (" XIA ", - 12359), Array, ARRAY ("xian", - 12346), Array ("XIAO", - 12300), Array ("XIE", - 12120), Array ("XIN", - 12099), Array ("Xing", - 12089), Array ("XIiong", - 12074), Array ("XU", - 12058), Array ("Xuan", - 12039), Array ("XUE", - 11867), Array ("Xun", - 11861), Array ("YA"

, -11847), Array ("YANG", - 11798), Array ("YAO", - 11781), Array ("Ye", - 11604), Array ("yi" , -11589), Array ("YING", - 11358), Array ("YO", - 11340), Array ("YONG", - 11339), Array ("you" , -11324), Array ("YUAN", - 11097), Array ("YUE", - 11077), Array ("Yun", - 11067), Array ("ZA" , -11055), Array ("ZAN", - 11045, Array ("Zang", - 11041), Array ("ZAO", - 11038), Array ("ZE" , -11024), Array ("ZEN", - 11019), Array ("Zeng", - 11018), Array ("ZHA", - 11014), Array ("zhai" Array ("ZHANG", - 10815), Array ("ZHAO", - 10800), Array ("ZHE", - 10790), Array ("zhen" , -10780), Array ("ZHI", - 10587), Array ("ZHONG", - 10544), Array ("ZHOU", - 10533), Array ("zhu" , -10519), Array ("Zhuai", - 10329), Array ("ZHUAN", - 10328), Array ("Zhuang", - 10322), Array ("zhui" , -10315), Array ("ZHUO", - 10307), Array ("Zi", - 10296), Array ("ZONG", - 10281), Array (Zou ", - 10274), Array (" Zuan ", - 10262), Array (" ZUI ", - 10260), Array (" Zun ", - 10256), Array ("Zuo", - 10254)); Function G ($ Num) {Global $ D; IF ($ NUM> 0 && $ Num <160) {Return Chr ($ Num);} elseif ($ Num <-20319 | $ Num> -10247) {Return "";} else {for ($ I = count ($ d) -1; $ i> = 0;

$ I -) {IF ($ D [$ I] [1] <= $ NUM) Break;} Return $ D [$ I] [0];}} Function C ($ Str) {$ RET = "" For ($ I = 0; $ I 160) {$ = ORD (Substr ($ STR, $ I, 1)); $ P = $ P * 256 $ Q-65536;} $ RET. = G ($ P);} Return $ RET;} Echo C ($ HZ );>

Enter Chinese here:

转载请注明原文地址:https://www.9cbs.com/read-28066.html

New Post(0)