如何将双引号中的所有字符串放入数组中


How do I get all the strings in double quotes into an array?

我有一个字符串,比如:- Array ( [jsonarray]=>["BRMS01","BRMS02","BRMS03"])1 .

怎样才能以这样一种方式解析它,即我只得到双引号内的字符串,例如 BRMS01.

这是我到目前为止尝试过的代码

<?php
require "init.php";
$jsonArray=json_decode($_POST['jsonArray']);
preg_match_all('/".*?"|''.*?''/', $jsonArray, $matches);
exit(print_r($matches));
mysqli_close($con);
?>

但是我得到一个空数组。任何帮助,不胜感激。谢谢:)

$_POST['jsonArray'] = '["BRMS01","BRMS02","BRMS03"]';
$jsonArray=json_decode($_POST['jsonArray']);
print_r($jsonArray);exit;

结果将是:

Array
(
    [0] => BRMS01
    [1] => BRMS02
    [2] => BRMS03
)

你可以使用$jsonArray[0]得到你需要的东西