Home > Backend Development > PHP Tutorial > How to escape special characters in url links

How to escape special characters in url links

WBOY
Release: 2016-07-25 08:53:56
Original
7811 people have browsed it
This article introduces the method of escaping special characters in URL links. Learn how to escape characters. Friends in need can refer to it.

Special characters in the URL address have special uses in the URL and cannot be passed directly in the URL. URL encoding is required.

The encoding format is: % plus the ASCII code of the character, that is, a percent sign %, followed by the ASCII (hexadecimal) code value of the corresponding character. URL special characters need to be escaped 1. Replace spaces with plus signs (+) 2. Forward slash (/) separates directories and subdirectories 3. Question mark (?) separates url and query 4. The percent sign (%) specifies special characters 5. Bookmark designated by # 6. Ampersand separates parameters

URL special symbols and corresponding hexadecimal value encoding: 1. The + sign in + url represents a space %2b 2. Spaces in the URL can be marked with a + sign or encoded with %20 3. / separates directories and subdirectories %2f 4. ? Separate the actual url and parameters %3f 5. % specifies the special character %25 6. # represents bookmark %23 7. & Separator between parameters specified in url %26 8. = The value of the parameter specified in the url %3d

Function to handle url escape characters in js escape, encodeuri, encodeuricomponent php filter parameter special characters anti-injection php method to filter illegal and special strings php example: example of special character processing function php code to replace special characters in extra long text



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template