PHP汉字转拼音
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;$i160){ $q=ord(substr($str,++$i,1)); $p=$p*256+$q-65536; } $ret.=g($p); } return $ret; } if (isset($_POST['ok']) and strlen(trim($_POST['chinese']))>0) { $str = $_POST['chinese']; } else { $str = "walkman"; } echo "说明:将中文转换为拼音 "; echo c($str); //echo c(""); //echo c("将中文转换为拼音"); ?>
&li;form action="<?php echo="$_server['php_self']"; ?> method="POST"> 请输入要转换的中文: