PHP Write WebService FAQs

Source: Internet
Author: User
Tags php write

1.php connection MySQL storage field contains '/' characters, Json_encode (), '/' will change to//, this is required a function: $array =str_replace ("\\/", "/", Json_encode ($arr)); /' Replace with '/'

2. Remove HTML tags from string, strip_tags ()

3.iconv ("GBK", "Utf-8//ignore", $UserName), GBK can accommodate uncommon characters IGNORE, ignoring errors

4.url value _get["name"] Chinese does not handle error, add conversion $name=iconv ("GBK", "UTF-8", $name), convert URL GBK to Utf-8 to pass value.

5.preg_replace ("#\\\u ([0-9a-f]{4}) #ie", "Iconv (' ucs-2be ', ' UTF-8 ', pack (' H4 ', ' \\1 '))", $str) revert to Chinese with regular conversions, Otherwise query the database after the page Chinese display Unicode encoding, similar to: \u5f71\uff0c\u53ea\u970018\u5206\u949f

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.