parse_str() 函數(shù)把查詢字符串解析到變量中.
語(yǔ)法:parse_str(string,array)
注釋:如果未設(shè)置 array 參數(shù),由該函數(shù)設(shè)置的變量將覆蓋已由同名變量,實(shí)例代碼如下:
*/?
parse_str("id=23&name=john%20adams"); echo $id."<br />"; echo $name; //23 //john $str="first=value&arr[]=foo+bar&arr[]=baz"; //定義字符串 parse_str($str); //把字符串解析為變量 echo $first; //輸出$first的值value echo "<br>"; echo $arr[0]; //輸出$arr[0]的值foo bar echo "<br>"; echo $arr[1]; //輸出$arr[1]的值baz echo "<br>"; parse_str($str,$output); //把字符串解析的變量存儲(chǔ)在$output中 echo $output['first']; //輸出$first的值value echo "<br>"; echo $output['arr'][0]; //輸出$arr[0]的值foo bar echo "<br>"; echo $output['arr'][1]; //輸出$arr[1]的值baz
/*?
注釋:php.ini 中的 magic_quotes_gpc 設(shè)置影響該函數(shù)的輸出,如果已啟用,那么在 parse_str() 解析之前,變量會(huì)被 addslashes() 轉(zhuǎn)換.
教程鏈接:
隨意轉(zhuǎn)載~但請(qǐng)保留教程地址★
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

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
Guide: Stellar Blade Save File Location/Save File Lost/Not Saving
4 weeks ago
By DDD
Oguri Cap Build Guide | A Pretty Derby Musume
2 weeks ago
By Jack chen
Agnes Tachyon Build Guide | A Pretty Derby Musume
2 weeks ago
By Jack chen
Dune: Awakening - Advanced Planetologist Quest Walkthrough
4 weeks ago
By Jack chen
Date Everything: Dirk And Harper Relationship Guide
4 weeks ago
By Jack chen

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)
