【发布时间】:2019-04-06 03:36:34
【问题描述】:
来自带有 https 的 url 的 json 数据的结果是混乱的,并且像错误字符串字符一样使用了 file_get 内容,如下面的代码所示
<?php
// header('Content-Type : application/x-www-form-urlencoded');
// header("Content-Type: text/html");
$url = "https://sirup.lkpp.go.id/sirup/servicecdn/paketpenyediapersatkertampil ?idSatker=95966&tahunAnggaran=2018";
// $url="http://jsonplaceholder.typicode.com/posts/";
// $url="http://localhost/appTestBengkulu/restAPI/aksesdata/";
$get_url = file_get_contents($url);
$datajson = json_decode($get_url);
var_dump($get_url);
// var_dump($datajson);
$data_array = array(
'datalist' => $datajson
);
// var_dump($data_array);
$this->load->view('vdatajson', $data_array);
with:file_get 内容网址 https://drive.google.com/open?id=1tGYU4lwAHKQMs8bN5Z9ns-45c4IZEZe_
与邮递员: https://drive.google.com/file/d/1-G_2LBT53vq-jyHWahBQyAdT203O86CY/view?usp=sharing
我使用了一些类似内容类型 utf8 或类似的建议,但结果是一样的 数据可以像数组数据 json 一样读取以供查看
【问题讨论】:
-
如何在视图中打印 vdatajson?
-
可能是你贴代码的时候弄错了,但是url中
?idSatker之前有空格
标签: php json codeigniter