用php中的正则表达式把{\"textField7\":\"ttt\",\"textField8\":\"tttt\"} string型转换为array型
补充:变成
Array
(
[textField7] => tt
[textField8] => ttt
)
答案:$str = "{\"textField7\":\"ttt\",\"textField8\":\"tttt\"}";
print_r( json_decode($str, true) );
其他:preg_match_all('#\\"(.+)\\":#i', '{\"textField7\":\"ttt\",\"textField8\":\"tttt\"}', $text);
preg_match_all('#:\\"(.+)\\"#i', '{\"textField7\":\"ttt\",\"textField8\":\"tttt\"}', $text2);
for ($i=1; $i<count($text); $i++){
$myarray .= array($text[$i],$text[$i]);
}
上一个:php中用于改变字符集编码的函数是什么
下一个:我在网上下PPT模板,但是下下来的是php的格式,怎么办?