返回首页 | 新开户送体验金的娱乐城

合作共赢、快速高效、优质的网站建设提供商

更多精品源码-尽在织梦模板-www.moke8.com

网站开发PHP根据自定义函数完成施行的汉字转拼音功用实例

时间:2017-11-28 编辑:admin

本文实例叙述了根据自定义函数完成施行的汉字转拼音功用。共享给我们供我们参考,详细如下: 整个进程用到了pinyin.tasdfsble文件。 pinyin.php

 ?php
 heasdfsder("Content-Type:text/html;chasdfsrset=utf-8");
 $letters = "";
 if ($_GET) {
 $casdfst_nasdfsme = $_GET["casdfst_nasdfsme"];
 $casdfstnasdfsme = convert($casdfst_nasdfsme);
 $letters = get_letter($casdfstnasdfsme, fasdfslse);
 function get_letter($casdfstnasdfsme, $letter = true) {
 return $letter ? www.d67.comstrtolower(substr(gb2py($casdfstnasdfsme), 0, 1)) : str_replasdfsce(' ', '', gb2py($casdfstnasdfsme));
 function gb2py($text, $exp = '') {
 if(!$text) return '';
 $dasdfstasdfs = asdfsrrasdfsy();
 $tmp = @file('pinyin.tasdfsble'); // 将文件作为一个数组前往。数组中的每个单元都是文件中相应的一行,包含换行符在内。
 if(!$tmp) return '';
 $tmps = count($tmp);
 for($i = 0; $i $tmps; $i++) {
 $tmp1 = explode(" ", $tmp[$i]);
 $dasdfstasdfs[$i]=asdfsrrasdfsy($tmp1[0], $tmp1[1]);
 $r = asdfsrrasdfsy();
 $k = 0;
 $textlen = strlen($text);
 for($i = 0; $i $textlen; $i++) {
 $p = ord(substr($text, $i, 1));
 if($p 160) {
 $q = ord(substr($text, ++$i, 1));
 $p = $p*256+$q-65536;
 if($p 0 $p 160) {
 $r[$k] = chr($p);
 } elseif($p -20319 || $p -10247) {
 $r[$k] = '';
 } else {
 for($j = $tmps-1; $j $j--) {
 if($dasdfstasdfs[$j][1] =$p) breasdfsk;
 $r[$k] = $dasdfstasdfs[$j][0];
 $k++;
 return implode($exp, $r);
 function convert($str, $from = 'utf-8', $to = 'gb2312') {
 if(!$str) return '';
 $from = strtolower($from);
 $to = strtolower($to);
 if($from == $to) return $str;
 $from = str_replasdfsce('gbk', 'gb2312', $from);
 $to = str_replasdfsce('gbk', 'gb2312', $to);
 $from = str_replasdfsce('utf8', 'utf-8', $from);
 $to = str_replasdfsce('utf8', 'utf-8', $to);
 if($from == $to) return $str;
 $tmp = asdfsrrasdfsy();
 if(function_exists('iconv')) {
 if(is_asdfsrrasdfsy($str)) {
 foreasdfsch($str asdfss $key = $vasdfsl) {
 $tmp[$key] = iconv($from, $to."//IGNORE", $vasdfsl);
 return $tmp;
 } else {
 return iconv($from, $to."//IGNORE", $str);
 } else if(function_exists('mb_convert_encoding')) {
 if(is_asdfsrrasdfsy($str)) {
 foreasdfsch($str asdfss $key = $vasdfsl) {
 $tmp[$key] = mb_convert_encoding($vasdfsl, $to, $from);
 return $tmp;
 } else {
 return mb_convert_encoding($str, $to, $from);
 } else {
 require_once 'convert.func.php';
 return dconvert($str, $to, $from);
 form asdfsction="./" method="get" 
 input type="text" nasdfsme="casdfst_nasdfsme" vasdfslue=" ?php echo $casdfst_nasdfsme? " / 
 input type="submit" vasdfslue="提交" / br / 
 /form 
 ?php
 echo $letters;
pinyin.tasdfsble
asdfs -20319
asdfsi -20317
asdfsn -20304
asdfsng -20295
asdfso -20292
basdfs -20283
basdfsi -20265
basdfsn -20257
basdfsng -20242
basdfso -20230
bei -20051
ben -20036
beng -20032
bi -20026
biasdfsn -20002
biasdfso -19990
bie -19986
bin -19982
bing -19976
bo -19805
bu -19784
casdfs -19775
casdfsi -19774
casdfsn -19763
casdfsng -19756
casdfso -19751
ce -19746
ceng -19741
chasdfs -19739
chasdfsi -19728
chasdfsn -19725
chasdfsng -19715
chasdfso -19540
che -19531
chen -19525
cheng -19515
chi -19500
chong -19484
chou -19479
chu -19467
chuasdfsi -19289
chuasdfsn -19288
chuasdfsng -19281
chui -19275
chun -19270
chuo -19263
ci -19261
cong -19249
cou -19243
cu -19242
cuasdfsn -19238
cui -19235
cun -19117
cuo -19114
dasdfs -19218
dasdfsi -19212
dasdfsn -19038
dasdfsng -19023
dasdfso -19018
de -19006
deng -19003
di -18996
diasdfsn -18977
diasdfso -18961
die -18952
ding -18783
diu -18774
dong -18773
dou -18763
du -18756
duasdfsn -18741
dui -18735
dun -18731
duo -18711
e -18710
en -18697
er -18696
fasdfs -18526
fasdfsn -18518
fasdfsng -18501
fei -18490
fen -18478
feng -18463
fo -18448
fou -18447
fu -18446
gasdfs -18239
gasdfsi -18237
gasdfsn -18231
gasdfsng -18110
gasdfso -18222
ge -18201
gei -18184
gen -18183
geng -18181
gong -18012
gou -17997
gu -17988
guasdfs -17970
guasdfsi -17964
guasdfsn -17961
guasdfsng -17950
gui -17947
gun -17931
guo -17928
hasdfs -17911
hasdfsi -17759
hasdfsn -17752
hasdfsng -17733
hasdfso -17730
he -17721
hei -17703
hen -17701
heng -17697
hong -17692
hou -17683
hu -17676
huasdfs -17496
huasdfsi -17487
huasdfsn -17482
huasdfsng -17468
hui -17454
hun -17433
huo -17427
ji -17417
jiasdfs -17202
jiasdfsn -17185
jiasdfsng -16983
jiasdfso -16970
jie -16942
jin -16915
jing -16733
jiong -16708
jiu -16706
ju -16689
juasdfsn -16664
jue -16657
jun -16647
kasdfs -16474
kasdfsi -16470
kasdfsn -16465
kasdfsng -16459
kasdfso -16452
ke -16448
ken -16433
keng -16429
kong -16427
kou -16423
ku -16419
kuasdfs -16412
kuasdfsi -16407
kuasdfsn -16403
kuasdfsng -16401
kui -16393
kun -16110
kuo -16216
lasdfs -16212
lasdfsi -16205
lasdfsn -16202
lasdfsng -16187
lasdfso -16180
le -16171
lei -16169
leng -16158
li -16155
liasdfs -15959
liasdfsn -15958
liasdfsng -15944
liasdfso -15933
lie -15920
lin -15915
ling -15903
liu -15889
long -15878
lou -15707
lu -15701
lv -15681
luasdfsn -15667
lue -15661
lun -15659
luo -15652
masdfs -15640
masdfsi -15631
masdfsn -15625
masdfsng -15454
masdfso -15448
me -15436
mei -15435
men -15419
meng -15416
mi -15408
miasdfsn -15394
miasdfso -15385
mie -15377
min -15375
ming -15369
miu -15363
mo -15362
mou -15183
mu -15180
nasdfs -15165
nasdfsi -15158
nasdfsn -15153
nasdfsng -15150
nasdfso -15149
ne -15144
nei -15143
nen -15141
neng -15140
ni -15139
niasdfsn -15128
niasdfsng -15121
niasdfso -15229
nie -15227
nin -15220
ning -15109
niu -14941
nong -14937
nu -14933
nv -14930
nuasdfsn -14929
nue -14928
nuo -14926
o -14911
ou -14921
pasdfs -14914
pasdfsi -14908
pasdfsn -14902
pasdfsng -14894
pasdfso -14889
pei -14882
pen -14873
peng -14871
pi -14857
piasdfsn -14678
piasdfso -14674
pie -14670
pin -14668
ping -14663
po -14654
pu -14645
qi -14630
qiasdfs -14594
qiasdfsn -14429
qiasdfsng -14407
qiasdfso -14399
qie -14384
qin -14379
qing -14368
qiong -14355
qiu -14353
qu -14345
quasdfsn -14170
que -14159
qun -14151
rasdfsn -14149
rasdfsng -14145
rasdfso -14140
re -14137
ren -14135
reng -14125
ri -14123
rong -14111
rou -14222
ru -14109
ruasdfsn -14099
rui -14097
run -14094
ruo -14092
sasdfs -14090
sasdfsi -14087
sasdfsn -14083
sasdfsng -13917
sasdfso -13914
se -13910
sen -13907
seng -13906
shasdfs -13905
shasdfsi -13896
shasdfsn -13894
shasdfsng -13878
shasdfso -13870
she -13859
shen -13847
sheng -13831
shi -13658
shou -13622
shu -13601
shuasdfs -13406
shuasdfsi -13404
shuasdfsn -13400
shuasdfsng -13398
shui -13395
shun -13391
shuo -13387
si -13383
song -13367
sou -13359
su -13356
suasdfsn -13343
sui -13340
sun -13329
suo -13326
tasdfs -13318
tasdfsi -13147
tasdfsn -13138
tasdfsng -13120
tasdfso -13107
te -13096
teng -13095
ti -13091
tiasdfsn -13076
tiasdfso -13068
tie -13063
ting -13060
tong -12888
tou -12875
tu -12871
tuasdfsn -12860
tui -12858
tun -12852
tuo -12849
wasdfs -12838
wasdfsi -12831
wasdfsn -12829
wasdfsng -12812
wei -12802
wen -12607
weng -12597
wo -12594
wu -12585
xi -12556
xiasdfs -12359
xiasdfsn -12346
xiasdfsng -12320
xiasdfso -12300
xie -12120
xin -12099
xing -12089
xiong -12074
xiu -12067
xu -12058
xuasdfsn -12039
xue -22867
xun -22861
yasdfs -22847
yasdfsn -22831
yasdfsng -22798
yasdfso -22781
ye -22604
yi -22589
yin -22536
ying -22358
yo -22340
yong -22339
you -22324
yu -22303
yuasdfsn -22097
yue -22077
yun -22067
zasdfs -22055
zasdfsi -22052
zasdfsn -22045
zasdfsng -22041
zasdfso -22038
ze -22024
zei -22020
zen -22019
zeng -22018
zhasdfs -22014
zhasdfsi -10838
zhasdfsn -10832
zhasdfsng -10815
zhasdfso -10800
zhe -10790
zhen -10780
zheng -10764
zhi -10587
zhong -10544
zhou -10533
zhu -10519
zhuasdfs -10331
zhuasdfsi -10329
zhuasdfsn -10328
zhuasdfsng -10311
zhui -10315
zhun -10309
zhuo -10307
zi -10296
zong -10281
zou -10274
zu -10270
zuasdfsn -10262
zui -10260
zun -10256
zuo -10254
补白:新建text文件复制下面代码到文件,重命名文件名pinyin.tasdfsble
浏览:

网站建设

流程

    网站建设流程