Use PHP to parse the source code of the conversion code of Chinese characters

Source: Internet
Author: User
Most programmers have been plagued by the problem of how to implement the code for converting Chinese characters to location codes in PHP. the following source code example can be of great help to everyone. The reference content is as follows :? Phpglobal $ PHP_SELF; echo $ PHP_SELF; $ t1 $ _ POST [textfield1, the following source code example can be of great help to everyone.







Reference content is as follows:

Global $ PHP_SELF;
// Echo $ PHP_SELF;
$ T1 = $ _ POST ['textfield1'];
$ T2 = $ _ POST ['textfield2'];
$ T3 = $ _ POST ['textfield3'];
$ T4 = $ _ POST ['textfield4 '];

// Chinese character -- Location Code
If ($ t1! = ""){
$ T2 = sprintf ("% 02d % 02d", ord ($ t1 [0])-160, ord ($ t1 [1])-160 );
// Echo $ t2;
}
// Location Code-Chinese characters
If ($ t3! = ""){
$ T4 = chr (substr ($ t3, 160) + 160). chr (substr ($ t3,) + );
// Echo $ t4;
}
?>

Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>



Untitled Document




Align = "center" cellpadding = "0" cellspacing = "0">

Class = "STYLE1"> Chinese character location code query system







Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.