最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么$match[1]的值是:steven jobs

$p = '/\w+:(\w+\s\w+)/';

$str = "name:steven jobs";

preg_match($p, $str, $match);

echo $match[1]; //結(jié)果為:steven jobs

print_r($match);


正在回答

3 回答

int?preg_match?(?string?$pattern?,?string?$subject?[,?array?&$matches?[,?int?$flags?=?0?[,?int$offset?=?0?]]]?)
//?$pattern?要搜索的模式,字符串類(lèi)型。
//?$subject?輸入字符串
//?$match?如果提供了參數(shù)matches,它將被填充為搜索結(jié)果。?$matches[0]將包含完整模式匹配到的文本,?$matches[1]?將包含第一個(gè)捕獲子組匹配到的文本,以此類(lèi)推。


3 回復(fù) 有任何疑惑可以回復(fù)我~

preg_match函數(shù)返回值數(shù)組中,首先返回匹配的字符串,你的代碼中有一個(gè)匹配,所以match[0]是name:steven jobs,而后返回的是分組,你的表達(dá)式中就一個(gè)分組,匹配結(jié)果為steven jobs,所以match[1]的值為steven jobs.

0 回復(fù) 有任何疑惑可以回復(fù)我~

$match[1]的索引是$str,而$str的屬性值是steven jobs

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么$match[1]的值是:steven jobs

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)