Solution to page script assignment failure caused by carriage return of a string when parameters are passed through a url _ PHP Tutorial

Source: Internet
Author: User
Solution to the failure of page script assignment caused by carriage return on the string when parameters are passed through the url address. When parameters are accepted through the url address, the value of some parameters includes the carriage return % 0A. at this time, when the script is displayed on the page, the value V is paid to the script variable, script errors may occur when parameters are accepted through the url address. some parameter values include the carriage return '% 0a'. when the script is displayed on the page, paying this value V to the script variable may cause a script error.

Therefore, the corresponding: Some strings are url encoded at the beginning when the value is passed, and url decoding is performed when the script assigns values, so as to avoid the above problems.

In PHP, the URL encoding operation function is:Urlencode () and urldecode ()

The corresponding URL encoding operation function in js is:EncodeURI () and decodeURI ()

% 0a'. when the script is displayed on the page, the value V is paid to the script variable, which may cause a script error...

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.