How to convert Chinese characters to location codes in php-PHP problem

The method of php Chinese character conversion location code: first create a PHP sample file; then pass “sprintf(“%02d%02d”,ord($t1[0])-160,ord($t1[1])- 160);” method to realize the conversion of Chinese characters to location codes. Recommendation: “PHP Video Tutorial” Analysis of source code application source code implementation of Chinese character conversion in PHP The problem of how to convert Chinese characters to location codes in PHP has been troubling most programmers, so the following source code example is believed to be of great help to everyone. The code is as follows: Chinese character location code query system “> Enter Chinese characters <input name="textfield1" type="text" value="” /> <input name="textfield2" type="text" value="” /> “> Enter the area code <input name="textfield3" type="text" value="” /> <input name="textfield4" type="text" value="” /> The above is the detailed content of how to convert Chinese characters to location codes in php. For more information, please pay attention to other related articles on 1024programmer.com!

How does php replace part of a string – PHP problem

How to replace part of the string in php: first create a PHP sample file; then use the “str_replace” function to replace the specified string. Recommendation: “PHP Video Tutorial” PHP replaces the specified string Use str_replace to replace the specified character String $param = & # 39; Banana peel is what rubbish & # 39;; $pattOne = [ & # 39; What rubbish & # 39;, & # 39; What rubbish & # 39;, & # 39; what kind of garbage & # 39;, & # 39; What kind of rubbish & # 39;, & # 39; what kind of garbage & # 39;, & # 39; what kind of garbage & # 39;, ]; $new_param = str_replace($pattone, '*', $param); $param = ' banana peel is What kind of rubbish’; $patttwo = [ //Put the words with more words in front to match first & # 39; Is it & # 39;, & # 39; Garbage & # 39;, & # 39; Does not belong to & # 39;, & # 39; Does it count & # 39;, ‘Which kind’, ‘Which category’, ‘Which’, & # 39; Which type & # 39;, & # 39; belongs to & # 39;, ‘A’,…

How to do php query mysql garbled characters-PHP problem

The solution to php querying mysql garbled characters: 1. Modify the encoding type of the PHP page language itself; 2. Change the MySQL character set to “UTF8”; 3. Use the encoding conversion function in ultraplus to convert. Recommendation: “PHP Video Tutorial” The solution to garbled characters when PHP reads mysql Chinese data 1. The encoding type of the PHP page language itself is not suitable. At this time, the Chinese you write directly in the script must be garbled characters, not to mention the database. Solution: Select & # 39; UTF8 & # 39; Or ‘gb2312’, so that the client’s browser will automatically select and display the correct Chinese. Note: ‘UTF8’ or ‘gb2312’ can display Chinese correctly. 2. The encoding type in the database MySQL is incorrect. Solution: When creating a database, select ‘UTF8’ for the MySQL character set, and select utf8_general_ci for the MySQL connection proofreading. There must be no problem with the database created in this way to store Chinese. Otherwise, your Chinese will be garbled characters in MySQL first, and don’t expect it to display correctly in the PHP page for you. 3. It is related to the usual script editing environment. For example, some content is…

How does php implement form submission without refreshing – PHP problem

How to implement form submission without refresh in php: first add “target=”id_iframe”” to the form form; then add code “ The above is how PHP implements form submission without refresh For more details, please pay attention to other related articles on 1024programmer.com!

How does php remove the last few characters-PHP problem

How to remove the last few characters in php: first create a PHP sample file; then define a string; finally use the “substr($str,0,-4);” method to remove the last specified character. Recommendation: “PHP Video Tutorial” <? php $str='programming'; //Define a string $res=substr($str,-4); //Process string echo "Return the last 4 characters {$res} of {$str} string"; $res=substr($str,0,-4); //Process string echo "Return to the {$str} string to remove the last 4 characters{$res}”;?> The above is the detailed content of how PHP removes the last few characters, and more Please pay more attention to other related articles on 1024programmer.com!

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索