且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在php中解析JSON字符串

更新时间:2023-01-17 17:05:45

正如大家所说,您做到了-使用json_decode.

As everyone said, and you did - use json_decode.

    $dateArrays  = json_decode($dateTimeArr, true); // decode JSON to associative array
    foreach($dateArrays as $dateArr){
        echo $dateArr['startDate']; 
        echo $dateArr['totalTime']; 
    }

将来,如果不确定变量中包含什么类型的数据或结构,请执行var_dump($var),它将打印变量的类型及其内容.

In future, if you are unsure what type or structure of data is in the variable, do var_dump($var) and it will print type of variable and its content.