


Introduction to the difference between php urlencode and rawurlencode_PHP tutorial
In PHP, both rawurlencode and rawurlencode encode characters. Let me introduce to you the difference between urlencode and rawurlencode. Friends who need to know can refer to it.
The purpose of urlencode is to encode a string and replace all non-alphanumeric characters except "-_" in the original string with a percent sign (%) followed by two hexadecimal digits. However, please note: For historical reasons, spaces will be replaced with + signs. Rawurlencode is actually the same as urlencode, and is also used to encode strings. The only difference is that it uses RFC1738 encoding, which means that spaces are replaced with %20.
Their corresponding decoding functions are urldecode and rawurldecode. Referring to the instructions on the official website, any %## and plus sign ('+') in the encoded string given by urldecode decoding are decoded into a space character; rawurldecode decodes the percent sign (%) in the character string followed by two Bit hexadecimal. There are two differences. First, urldecode will decode any two characters after the percent sign (%). For example, %MN will also be decoded, but it will fail; rawurldecode will only decode the percent sign (%). Only the last two characters in hexadecimal (0-9A-F) will be decoded. Second, urldecode will decode the + sign into a space.
Let’s take a look at the official introduction of the two functions in PHP.
urlencode — encode a URL string
Report a bug Description
string urlencode ( string $str )
This function makes it easy to encode a string and use it in the request part of the URL, and it also makes it easy to pass variables to the next page.
Report a bug parameter
str
The string to encode.
Report a bug return value
Returns a string in which all non-alphanumeric characters except -_. are replaced with a percent sign (%) followed by two hexadecimal digits, and 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 RFC1738 encoding (see rawurlencode()) in encoding spaces as plus signs (+).
The code is as follows
|
Copy code
echo '';
echo '';
Example #1 在 FTP URL 里包含一个密码
echo '';
|

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

C language functions are the basis for code modularization and program building. They consist of declarations (function headers) and definitions (function bodies). C language uses values to pass parameters by default, but external variables can also be modified using address pass. Functions can have or have no return value, and the return value type must be consistent with the declaration. Function naming should be clear and easy to understand, using camel or underscore nomenclature. Follow the single responsibility principle and keep the function simplicity to improve maintainability and readability.

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

Detailed explanation of XPath search method under DOM nodes In JavaScript, we often need to find specific nodes from the DOM tree based on XPath expressions. If you need to...

Although C and C# have similarities, they are completely different: C is a process-oriented, manual memory management, and platform-dependent language used for system programming; C# is an object-oriented, garbage collection, and platform-independent language used for desktop, web application and game development.

In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

C language functions are reusable code blocks. They receive input, perform operations, and return results, which modularly improves reusability and reduces complexity. The internal mechanism of the function includes parameter passing, function execution, and return values. The entire process involves optimization such as function inline. A good function is written following the principle of single responsibility, small number of parameters, naming specifications, and error handling. Pointers combined with functions can achieve more powerful functions, such as modifying external variable values. Function pointers pass functions as parameters or store addresses, and are used to implement dynamic calls to functions. Understanding function features and techniques is the key to writing efficient, maintainable, and easy to understand C programs.

The... (splat) operator in PHP is used to unpack function parameters and arrays, improving code simplicity and efficiency. 1) Function parameter unpacking: Pass the array element as a parameter to the function. 2) Array unpacking: Unpack an array into another array or as a function parameter.
