How to convert php url to array

藏色散人
Release: 2023-03-03 17:04:02
Original
3006 people have browsed it

php url to array method: first get the url string; then parse the query string into variables through the parse_str function, and store the variables into an array; finally print out the converted value through "var_dump" Just an array.

How to convert php url to array

Recommended: "PHP Video Tutorial"

Convert the string of URL with & into an array

For example:

$str = "title=我是小白&name=真的很白&text=但是决不放弃";
parse_str($str, $res);   //第一个参数为字符串,第二个参数为结果
var_dump($res);
exit;
Copy after login

The above is the detailed content of How to convert php url to array. For more information, please follow other related articles on the PHP Chinese website!

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