php using get Get URL Chinese characters garbled solution, geturl_php tutorial

Source: Internet
Author: User
Tags urlencode

php using get Get URL Chinese characters garbled solution, Geturl


In this paper, we describe a workaround for PHP to get the URL of Chinese characters garbled by using get. Share to everyone for your reference. Here's how:

First, the question:

Originally intended to use this
Copy the Code code as follows: [View jurisdiction dynamic]
Results are obtained on the list.php page-view [territory dynamic Yiwen]
At first it may be that the "state" of the Chinese character is in conflict with something, so garbled.

Second, the solution:

Use:
Copy the code as follows: "charset=" Utf-8 "target=" main ">[view]
Then use it on the list.php page
Copy the Code code as follows:
<?php
Header ("content-type:text/html; Charset=utf-8 ");
if ($_get[' plate ')
echo $plate =urldecode ($_get[' plate ');
?>

It will not be garbled and the transmission is not normal.
Note Here the receive Get page encoding needs to be consistent with the sending side!

About the string UrlEncode (string $str) function

This function makes it easy to encode a string and use it for the request part of the URL, and it also facilitates the passing of a variable to the next page.
Example 1 UrlEncode ()
Copy the Code code as follows: <?php
Echo ';
?>
Example 2 UrlEncode () and Htmlentities ()
Copy the Code code as follows: <?php
$query _string = ' foo= '. UrlEncode ($foo). ' &bar= '. UrlEncode ($bar);
Echo ';
?>

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/910585.html www.bkjia.com true http://www.bkjia.com/PHPjc/910585.html techarticle php using get get URL Chinese characters garbled solution, Geturl This article describes the PHP use get get URL Chinese characters garbled solution. Share to everyone for your reference. Specific Party ...

  • Related Article

    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.