小编use*_*018的帖子

怎么做我只使用PHP获取双引号字符串

如何通过使用php将所有字符串括在一对双引号中,我想在下面的字符串中获取它们,

$str = 'a:2:{i:1;a:4:{i:1;s:4:"2000";i:2;s:8:"10th STD";i:3;s:9:"Full Time";i:4;s:24:"State Board of Education";}i:2;a:4:{i:1;s:4:"2003";i:2;s:8:"12th STD";i:3;s:9:"Full Time";i:4;s:24:"State Board of Education";}}';
Run Code Online (Sandbox Code Playgroud)

我想要输出如下

2000
10th STD
Full Time
State Board of Education
Run Code Online (Sandbox Code Playgroud)

我尝试了以下代码,但仅输出 2000

<?php

$str = 'a:2:{i:1;a:4:{i:1;s:4:"2000";i:2;s:8:"10th STD";i:3;s:9:"Full Time";i:4;s:24:"State Board of Education";}i:2;a:4:{i:1;s:4:"2003";i:2;s:8:"12th STD";i:3;s:9:"Full Time";i:4;s:24:"State Board of Education";}}'

if (preg_match('/"([^"]+)"/', $str, $m)) 
{
print $m[1];   
} 
else 
{

}
<?
Run Code Online (Sandbox Code Playgroud)

请建议我怎么做,我应该用哪个功能来获取输出?

php string

-1
推荐指数
1
解决办法
134
查看次数

标签 统计

php ×1

string ×1