下列正则表达式! 用正则表达式把str中匹配的各项放到数组中。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $reg = "/&(str[0-9])=([0-9])/U";preg_match_all($res, $str, $out);array_combine($out[1], $out[2]); <?php$str="&str1=1&str2=2&str3=3";preg_match_all("|&([\w]+)=([\w])|",$str,$match,PREG_PATTERN_ORDER);$num=count($match[0]);for($i=0;$i<$num;$i++){ $mat_key=$match[1][$i]; $mat_val=$match[2][$i]; $arr[$mat_key]=$mat_val;}print_r($arr);?> http://www.52its.com/article/docslist.htm在这里找正则表达式相关的内容 <?php$str = "&str1=1&str2=2&str3=3";$ptr = "/([^&=]+)=([^&=]*)/";preg_match_all($ptr,$str,$result,PREG_SET_ORDER);for ($i=0;$i<count($result);$i++) { echo "键:".$result[$i][1]."<br>"; echo "值:".$result[$i][2]."<hr>";}?> 很像知道这种平缓出现图片的效果是怎么做的 php中如何从文件中获取一个用户的相关信息 有关于apache urlrewrite 二级域名的问题 输出字母表问题 这些参数如何设置? PHP 搜索后分页问题 急~~~ 熟悉smarty类的前辈来帮我看看这个问题 php.ini里已经添加了extension=php_com_dotnet.dll,但是为什么菜单里看不到? 真的好莱呀~~~~小问题又来了 PHP调用C#Webservice如果判断是否有数据呢? 遇上下面问题该怎么解决?是APACHE+PHP的安装问题. [我是新手]mysql的有关问题
preg_match_all($res, $str, $out);
array_combine($out[1], $out[2]);
$str="&str1=1&str2=2&str3=3";
preg_match_all("|&([\w]+)=([\w])|",$str,$match,PREG_PATTERN_ORDER);
$num=count($match[0]);
for($i=0;$i<$num;$i++)
{
$mat_key=$match[1][$i];
$mat_val=$match[2][$i];
$arr[$mat_key]=$mat_val;
}
print_r($arr);
?>
在这里找正则表达式相关的内容
$str = "&str1=1&str2=2&str3=3";
$ptr = "/([^&=]+)=([^&=]*)/";
preg_match_all($ptr,$str,$result,PREG_SET_ORDER);
for ($i=0;$i<count($result);$i++) {
echo "键:".$result[$i][1]."<br>";
echo "值:".$result[$i][2]."<hr>";
}
?>