我有这个API
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let targetViewController = storyboard.instantiateViewControllerWithIdentifier("targetViewControllerID") as? TargetViewController
self.navigationController?.pushViewController(targetViewController!, animated: true)
和 Auth-Token =" XXXXXXXXXX"
我想使用PHP从这个API获取JSON。
注意:我是PHP新手,请帮助。
答案 0 :(得分:4)
使用json_decode将json数据转换为数组。
$url='http://your_url';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'rohit');
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
$resultArray = json_decode($result);
echo "<pre>";
print_r($resultArray);
答案 1 :(得分:4)
这也可以作为..
$( document ).ready(function() {
//your code goes here
//bind the all events and do other stuff
});
or
$(function(){
//your code goes here
//bind the all events and do other stuff
});