<?php
/**
Generation of Phonetic Code table:
Start the Input method Builder to load the window's phonetic input method on the Reverse Conversion tab and save it as a text
This document (Winpy.txt) is standby.
The following code loads the Phonetic Code table file (text) into the array $pymb: (Pinyin, (Chinese characters ...))
Code table conversion Time is longer, should be converted to save separately
*/
$filename = "Pymb.txt";
if (file_exists ($filename)) {
$fp = fopen ($filename, "R");
$PYMB = Unserialize (Fread ($fp, FileSize ($filename));
Fclose ($FP);
}else {
$filename = "Winpy.txt";
$fp = fopen ($filename, "R");
$old = "";
$ar = Array ();
$PYMB = Array ();
while (! feof ($fp)) {
$buffer = fgets ($fp, 128);
SSCANF ($buffer, "%2s%s", $ch, $py);
if ($ch >= "Ah" && Ord ($py) < 128) {
$PYMB [$ch] = $py;
}
}
Fclose ($FP);
$fp = fopen ("Pymb.txt", "w");
Fwrite ($FP, Serialize ($PYMB). " \ n ");
Fclose ($FP);
}
?>
Use examples to add Pinyin to text <br>
?
/**
Use examples to add Pinyin to text. For simplicity, the assumption is all Chinese
*/
$text = "Generation of phonetic Code table:
Start the Input method Builder to load the window's phonetic input method on the Reverse Conversion tab and save it as a text
This document (Winpy.txt) is standby.
The following code loads the Phonetic Code table file (text) into the array $pymb: (Pinyin, (Chinese characters ...))
Code table conversion Time is longer, should be converted to save separately
";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.