Home > Backend Development > PHP Problem > What are the php url transcoding functions?

What are the php url transcoding functions?

藏色散人
Release: 2023-03-09 09:16:02
Original
2904 people have browsed it

php url transcoding functions include: 1. The urlencode function is used to encode the URL string; 2. The urldecode function is used to decode the encoded URL string; 3. The rawurlencode function is used to encode the URL according to RFC3986 ;4. rawurldecode is used for decoding.

What are the php url transcoding functions?

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

  • urlencode — Encode URL string

Description

urlencode ( string $str ) : string
Copy after login

This function facilitates encoding a string and using it in the request part of the URL, and it also facilitates converting variables Passed to the next page.

Parameters

str

The string to be encoded.

Return value

Returns a string. All non-alphanumeric characters in this string except -_. will be replaced with a percent sign (%) followed by two digits. Base number, spaces are encoded as plus signs ( ). This encoding is the same as the encoding of WWW form POST data, and the same encoding as the application/x-www-form-urlencoded media type. For historical reasons, this encoding differs from the » RFC3986 encoding (see rawurlencode()) in encoding spaces as plus signs ( ).

  • urldecode — Decode an encoded URL string

Description

urldecode ( string $ str ) : string

Decode any %## in the given encoded string. The plus sign (' ') is decoded into a space character.

Parameters

str

The string to be decoded.

Return value

Returns the decoded string.

  • rawurlencode() - Encodes a URL according to RFC 3986

  • ##rawurldecode() - Decodes an encoded URL string

[Recommended learning:

PHP video tutorial]

The above is the detailed content of What are the php url transcoding functions?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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