久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      json如何轉(zhuǎn)php

      json如何轉(zhuǎn)php

      json如何轉(zhuǎn)php?

      json_decode是php5.2.0之后新增的一個(gè)PHP內(nèi)置函數(shù),其作用是對(duì)JSON格式的字符串進(jìn)行編碼.

        json_decode的語法規(guī)則:

        json_decode ( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] )

        json_decode接受一個(gè)JSON格式的字符串并且把它轉(zhuǎn)換為PHP變量 ,當(dāng)該參數(shù)$assoc為TRUE時(shí),將返回array,否則返回object。

        JSON 格式的字符串

        $json = '{"a":"php","b":"mysql","c":3}';

        其中a為鍵,php為a的鍵值。

        實(shí)例:

      <?php    $json = '{"a":"php","b":"mysql","c":3}';   $json_Class=json_decode($json);    $json_Array=json_decode($json, true);    print_r($json_Class);    print_r($json_Array);          ?>

        程序輸出:

        stdClass Object (   [a] => php   [b] => mysql   [c] => 3 )   Array (   [a] => php   [b] => mysql   [c] => 3 )

        在上面代碼的前提下

        訪問對(duì)象類型$json_Class的a的值

      echo $json_Class->{'a'};

        程序輸出:php

        訪問數(shù)組類型$json_Array的a的值

      echo $json_Array['a'];

        程序輸出:php

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)