国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 php手冊(cè) php 把查詢字符串解析到變量中

php 把查詢字符串解析到變量中

Jun 02, 2016 am 09:14 AM

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[&#39;first&#39;];         //輸出$first的值value 
echo "<br>"; 
echo $output[&#39;arr&#39;][0];         //輸出$arr[0]的值foo bar 
echo "<br>"; 
echo $output[&#39;arr&#39;][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 AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)