Current Location: Home> Function Categories> rawurldecode

rawurldecode

Decode the encoded URL string
Name:rawurldecode
Category:URLs
Programming Language:php
One-line Description:Decode the URL-encoded string and restore the special characters into the original characters

Function: rawurldecode()

Applicable version: PHP 4, PHP 5, PHP 7

Usage: rawurldecode(string $str): string

Function function: decode URL-encoded strings and restore special characters to original characters.

parameter:

  • $str: The URL-encoded string that needs to be decoded.

Return value:

  • The decoded string.

Example:

 $url = 'http%3A%2F%2Fwww.example.com%2Fpage%3Fid%3D123%26name%3DJohn%20Doe'; $decodedUrl = rawurldecode($url); echo $decodedUrl;

Output:

 http://www.example.com/page?id=123&name=John Doe

In the example above, we have a URL-encoded string that is decoded using the rawurldecode() function. The decoded string can be displayed normally, and special characters (such as colons, slashes, and spaces) are restored to the original characters.

Similar Functions
Popular Articles