小编Ste*_*n M的帖子

PHP json_decode无法正常工作

我试图使用PHP的json_decode函数从json对象获取特定值.示例代码如下:

foreach ($streams as &$i) {
        $chan = "http://api.justin.tv/api/stream/list.json?channel=" . $i;
        $json = file_get_contents($chan);   //Turns the gathered file information into a string for searching purposes.
        echo $json . " End of json variable.<br>";
        $exist = strpos($json, 'name');     // Search the file/json object for the name attribute
        if($exist) {                        //  Check to see if a name existed and if so add it to the live streams and get the image.
            echo " <a href=\"http://justin.tv/" . $i . "\">" . $i . …
Run Code Online (Sandbox Code Playgroud)

php json

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

json ×1

php ×1