Home > Backend Development > PHP Problem > How to convert php url to array

How to convert php url to array

藏色散人
Release: 2023-03-05 08:30:01
Original
4777 people have browsed it

How to convert php url to an array: First create a PHP sample file; then define a url parameter string; finally use the "parse_str($str, $arr);" method to convert the url to an array. .

How to convert php url to array

Recommended: "PHP Video Tutorial"

parse_str()—Convert the url parameter string into an array

Convert url parameter string into array

$str = 'a=1&b=2&c=3';
parse_str($str, $arr);
var_dump($arr);
//输出 
array (size=3)
  'a' =>  '1' (length=1)
  'b' =>  '2' (length=1)
  'c' =>  '3' (length=1)
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