Signature
Parameters
The string to encode
Return Value
URL-encoded string, or NULL if input is NULL
Description
Theurl_encode() function converts special characters to percent-encoded format, making strings safe for URLs.
Examples
Encode Search Query
Build Safe Links
Encoding Examples
| Input | Output |
|---|---|
hello world | hello%20world |
user@example.com | user%40example.com |
a&b=c | a%26b%3Dc |
20% off! | 20%25%20off%21 |
Related Functions
- sqlpage.link() - Build URLs (handles encoding automatically)
- sqlpage.path() - Get current path