一个汉字转拼音的函数_MySQL

WBOY
풀어 주다: 2016-06-01 14:05:01
원래의
979명이 탐색했습니다.
CODE
  1. // 作者:qiushuiwuhen 来源:CSDN
  2. $d = array(
  3. array("a",-20319),
  4. array("ai",-20317),
  5. array("an",-20304),
  6. array("ang",-20295),
  7. array("ao",-20292),
  8. array("ba",-20283),
  9. array("bai",-20265),
  10. array("ban",-20257),
  11. array("bang",-20242),
  12. array("bao",-20230),
  13. array("bei",-20051),
  14. array("ben",-20036),
  15. array("beng",-20032),
  16. array("bi",-20026),
  17. array("bian",-20002),
  18. array("biao",-19990),
  19. array("bie",-19986),
  20. array("bin",-19982),
  21. array("bing",-19976),
  22. array("bo",-19805),
  23. array("bu",-19784),
  24. array("ca",-19775),
  25. array("cai",-19774),
  26. array("can",-19763),
  27. array("cang",-19756),
  28. array("cao",-19751),
  29. array("ce",-19746),
  30. array("ceng",-19741),
  31. array("cha",-19739),
  32. array("chai",-19728),
  33. array("chan",-19725),
  34. array("chang",-19715),
  35. array("chao",-19540),
  36. array("che",-19531),
  37. array("chen",-19525),
  38. array("cheng",-19515),
  39. array("chi",-19500),
  40. array("chong",-19484),
  41. array("chou",-19479),
  42. array("chu",-19467),
  43. array("chuai",-19289),
  44. array("chuan",-19288),
  45. array("chuang",-19281),
  46. array("chui",-19275),
  47. array("chun",-19270),
  48. array("chuo",-19263),
  49. array("ci",-19261),
  50. array("cong",-19249),
  51. array("cou",-19243),
  52. array("cu",-19242),
  53. array("cuan",-19238),
  54. array("cui",-19235),
  55. array("cun",-19227),
  56. array("cuo",-19224),
  57. array("da",-19218),
  58. array("dai",-19212),
  59. array("dan",-19038),
  60. array("dang",-19023),
  61. array("dao",-19018),
  62. array("de",-19006),
  63. array("deng",-19003),
  64. array("di",-18996),
  65. array("dian",-18977),
  66. array("diao",-18961),
  67. array("die",-18952),
  68. array("ding",-18783),
  69. array("diu",-18774),
  70. array("dong",-18773),
  71. array("dou",-18763),
  72. array("du",-18756),
  73. array("duan",-18741),
  74. array("dui",-18735),
  75. array("dun",-18731),
  76. array("duo",-18722),
  77. array("e",-18710),
  78. array("en",-18697),
  79. array("er",-18696),
  80. array("fa",-18526),
  81. array("fan",-18518),
  82. array("fang",-18501),
  83. array("fei",-18490),
  84. array("fen",-18478),
  85. array("feng",-18463),
  86. array("fo",-18448),
  87. array("fou",-18447),
  88. array("fu",-18446),
  89. array("ga",-18239),
  90. array("gai",-18237),
  91. array("gan",-18231),
  92. array("gang",-18220),
  93. array("gao",-18211),
  94. array("ge",-18201),
  95. array("gei",-18184),
  96. array("gen",-18183),
  97. array("geng",-18181),
  98. array("gong",-18012),
  99. array("gou",-17997),
  100. array("gu",-17988),
  101. array("gua",-17970),
  102. array("guai",-17964),
  103. array("guan",-17961),
  104. array("guang",-17950),
  105. array("gui",-17947),
  106. array("gun",-17931),
  107. array("guo",-17928),
  108. array("ha",-17922),
  109. array("hai",-17759),
  110. array("han",-17752),
  111. array("hang",-17733),
  112. array("hao",-17730),
  113. array("he",-17721),
  114. array("hei",-17703),
  115. array("hen",-17701),
  116. array("heng",-17697),
  117. array("hong",-17692),
  118. array("hou",-17683),
  119. array("hu",-17676),
  120. array("hua",-17496),
  121. array("huai",-17487),
  122. array("huan",-17482),
  123. array("huang",-17468),
  124. array("hui",-17454),
  125. array("hun",-17433),
  126. array("huo",-17427),
  127. array("ji",-17417),
  128. array("jia",-17202),
  129. array("jian",-17185),
  130. array("jiang",-16983),
  131. array("jiao",-16970),
  132. array("jie",-16942),
  133. array("jin",-16915),
  134. array("jing",-16733),
  135. array("jiong",-16708),
  136. array("jiu",-16706),
  137. array("ju",-16689),
  138. array("juan",-16664),
  139. array("jue",-16657),
  140. array("jun",-16647),
  141. array("ka",-16474),
  142. array("kai",-16470),
  143. array("kan",-16465),
  144. array("kang",-16459),
  145. array("kao",-16452),
  146. array("ke",-16448),
  147. array("ken",-16433),
  148. array("keng",-16429),
  149. array("kong",-16427),
  150. array("kou",-16423),
  151. array("ku",-16419),
  152. array("kua",-16412),
  153. array("kuai",-16407),
  154. array("kuan",-16403),
  155. array("kuang",-16401),
  156. array("kui",-16393),
  157. array("kun",-16220),
  158. array("kuo",-16216),
  159. array("la",-16212),
  160. array("lai",-16205),
  161. array("lan",-16202),
  162. array("lang",-16187),
  163. array("lao",-16180),
  164. array("le",-16171),
  165. array("lei",-16169),
  166. array("leng",-16158),
  167. array("li",-16155),
  168. array("lia",-15959),
  169. array("lian",-15958),
  170. array("liang",-15944),
  171. array("liao",-15933),
  172. array("lie",-15920),
  173. array("lin",-15915),
  174. array("ling",-15903),
  175. array("liu",-15889),
  176. array("long",-15878),
  177. array("lou",-15707),
  178. array("lu",-15701),
  179. array("lv",-15681),
  180. array("luan",-15667),
  181. array("lue",-15661),
  182. array("lun",-15659),
  183. array("luo",-15652),
  184. array("ma",-15640),
  185. array("mai",-15631),
  186. array("man",-15625),
  187. array("mang",-15454),
  188. array("mao",-15448),
  189. array("me",-15436),
  190. array("mei",-15435),
  191. array("men",-15419),
  192. array("meng",-15416),
  193. array("mi",-15408),
  194. array("mian",-15394),
  195. array("miao",-15385),
  196. array("mie",-15377),
  197. array("min",-15375),
  198. array("ming",-15369),
  199. array("miu",-15363),
  200. array("mo",-15362),
  201. array("mou",-15183),
  202. array("mu",-15180),
  203. array("na",-15165),
  204. array("nai",-15158),
  205. array("nan",-15153),
  206. array("nang",-15150),
  207. array("nao",-15149),
  208. array("ne",-15144),
  209. array("nei",-15143),
  210. array("nen",-15141),
  211. array("neng",-15140),
  212. array("ni",-15139),
  213. array("nian",-15128),
  214. array("niang",-15121),
  215. array("niao",-15119),
  216. array("nie",-15117),
  217. array("nin",-15110),
  218. array("ning",-15109),
  219. array("niu",-14941),
  220. array("nong",-14937),
  221. array("nu",-14933),
  222. array("nv",-14930),
  223. array("nuan",-14929),
  224. array("nue",-14928),
  225. array("nuo",-14926),
  226. array("o",-14922),
  227. array("ou",-14921),
  228. array("pa",-14914),
  229. array("pai",-14908),
  230. array("pan",-14902),
  231. array("pang",-14894),
  232. array("pao",-14889),
  233. array("pei",-14882),
  234. array("pen",-14873),
  235. array("peng",-14871),
  236. array("pi",-14857),
  237. array("pian",-14678),
  238. array("piao",-14674),
  239. array("pie",-14670),
  240. array("pin",-14668),
  241. array("ping",-14663),
  242. array("po",-14654),
  243. array("pu",-14645),
  244. array("qi",-14630),
  245. array("qia",-14594),
  246. array("qian",-14429),
  247. array("qiang",-14407),
  248. array("qiao",-14399),
  249. array("qie",-14384),
  250. array("qin",-14379),
  251. array("qing",-14368),
  252. array("qiong",-14355),
  253. array("qiu",-14353),
  254. array("qu",-14345),
  255. array("quan",-14170),
  256. array("que",-14159),
  257. array("qun",-14151),
  258. array("ran",-14149),
  259. array("rang",-14145),
  260. array("rao",-14140),
  261. array("re",-14137),
  262. array("ren",-14135),
  263. array("reng",-14125),
  264. array("ri",-14123),
  265. array("rong",-14122),
  266. array("rou",-14112),
  267. array("ru",-14109),
  268. array("ruan",-14099),
  269. array("rui",-14097),
  270. array("run",-14094),
  271. array("ruo",-14092),
  272. array("sa",-14090),
  273. array("sai",-14087),
  274. array("san",-14083),
  275. array("sang",-13917),
  276. array("sao",-13914),
  277. array("se",-13910),
  278. array("sen",-13907),
  279. array("seng",-13906),
  280. array("sha",-13905),
  281. array("shai",-13896),
  282. array("shan",-13894),
  283. array("shang",-13878),
  284. array("shao",-13870),
  285. array("she",-13859),
  286. array("shen",-13847),
  287. array("sheng",-13831),
  288. array("shi",-13658),
  289. array("shou",-13611),
  290. array("shu",-13601),
  291. array("shua",-13406),
  292. array("shuai",-13404),
  293. array("shuan",-13400),
  294. array("shuang",-13398),
  295. array("shui",-13395),
  296. array("shun",-13391),
  297. array("shuo",-13387),
  298. array("si",-13383),
  299. array("song",-13367),
  300. array("sou",-13359),
  301. array("su",-13356),
  302. array("suan",-13343),
  303. array("sui",-13340),
  304. array("sun",-13329),
  305. array("suo",-13326),
  306. array("ta",-13318),
  307. array("tai",-13147),
  308. array("tan",-13138),
  309. array("tang",-13120),
  310. array("tao",-13107),
  311. array("te",-13096),
  312. array("teng",-13095),
  313. array("ti",-13091),
  314. array("tian",-13076),
  315. array("tiao",-13068),
  316. array("tie",-13063),
  317. array("ting",-13060),
  318. array("tong",-12888),
  319. array("tou",-12875),
  320. array("tu",-12871),
  321. array("tuan",-12860),
  322. array("tui",-12858),
  323. array("tun",-12852),
  324. array("tuo",-12849),
  325. array("wa",-12838),
  326. array("wai",-12831),
  327. array("wan",-12829),
  328. array("wang",-12812),
  329. array("wei",-12802),
  330. array("wen",-12607),
  331. array("weng",-12597),
  332. array("wo",-12594),
  333. array("wu",-12585),
  334. array("xi",-12556),
  335. array("xia",-12359),
  336. array("xian",-12346),
  337. array("xiang",-12320),
  338. array("xiao",-12300),
  339. array("xie",-12120),
  340. array("xin",-12099),
  341. array("xing",-12089),
  342. array("xiong",-12074),
  343. array("xiu",-12067),
  344. array("xu",-12058),
  345. array("xuan",-12039),
  346. array("xue",-11867),
  347. array("xun",-11861),
  348. array("ya",-11847),
  349. array("yan",-11831),
  350. array("yang",-11798),
  351. array("yao",-11781),
  352. array("ye",-11604),
  353. array("yi",-11589),
  354. array("yin",-11536),
  355. array("ying",-11358),
  356. array("yo",-11340),
  357. array("yong",-11339),
  358. array("you",-11324),
  359. array("yu",-11303),
  360. array("yuan",-11097),
  361. array("yue",-11077),
  362. array("yun",-11067),
  363. array("za",-11055),
  364. array("zai",-11052),
  365. array("zan",-11045),
  366. array("zang",-11041),
  367. array("zao",-11038),
  368. array("ze",-11024),
  369. array("zei",-11020),
  370. array("zen",-11019),
  371. array("zeng",-11018),
  372. array("zha",-11014),
  373. array("zhai",-10838),
  374. array("zhan",-10832),
  375. array("zhang",-10815),
  376. array("zhao",-10800),
  377. array("zhe",-10790),
  378. array("zhen",-10780),
  379. array("zheng",-10764),
  380. array("zhi",-10587),
  381. array("zhong",-10544),
  382. array("zhou",-10533),
  383. array("zhu",-10519),
  384. array("zhua",-10331),
  385. array("zhuai",-10329),
  386. array("zhuan",-10328),
  387. array("zhuang",-10322),
  388. array("zhui",-10315),
  389. array("zhun",-10309),
  390. array("zhuo",-10307),
  391. array("zi",-10296),
  392. array("zong",-10281),
  393. array("zou",-10274),
  394. array("zu",-10270),
  395. array("zuan",-10262),
  396. array("zui",-10260),
  397. array("zun",-10256),
  398. array("zuo",-10254)
  399. );
  400. function g($num){
  401. global $d;
  402. if($num>0&&$num
  403.  return chr($num);
  404. }
  405. elseif($num-10247){
  406.  return "";
  407. }else{
  408.  for($i=count($d)-1;$i>=0;$i--){if($d[$i][1]break;}
  409.  return $d[$i][0];
  410. }
  411. }
  412.  
  413. function c($str){
  414. $ret="";
  415. for($i=0;$i
  416.  $p=ord(substr($str,$i,1));
  417.  if($p>160){
  418.   $q=ord(substr($str,++$i,1));
  419.   $p=$p*256+$q-65536;
  420.  }
  421.  $ret.=g($p);
  422. }
  423. return $ret;
  424. }
  425.  
  426. echo "拼音为:".c($_POST['hz']);
  427. ?>
  428.  

  429.  
  430. 请在此处输入中文:
  431. value="Submit">
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿