日期:2014-05-17 浏览次数:20530 次
{"total":359,"data":[{"Id":113023,"ProductId":2905,"ProductCode":"SZX01","ProductName":"计算机图书系列","ProcessDays":1,"ProcessResume":"","WorkDayPrice":79.0000,"WeekdayPrice":89.0000,"NormalPrice":0.0000,"Catalog":"0","Type":0,"RDCatalog":0,"BizCatalog":0,"StartDate":new Date(1350691200000),"Deleted":0},{"Id":113024,"TourId":2905,"ProductCode":"SZX01","ProductName":"儿童图书教系列","ProcessDays":1,"ProcessResume":"","WorkDayPrice":79.0000,"WeekdayPrice":89.0000,"NormalPrice":0.0000,"Catalog":"0","Type":0,"RDCatalog":0,"BizCatalog":0,"StartDate":new Date(1350777600000),"Deleted":0}]}
<?php header ("Content-Type:text/html; charset=UTF-8"); $url = 'http://58.61.153.173/dataport/GetAllTourInfo.ashx'; $host=array('user: admin','password: admin_123'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_HTTPHEADER,$host); $output = curl_exec($ch); print $output; //数据能打印出来,如上面那数据 $response = json_decode($output);//加上后边这两句,也不报错、但是也没有数据打印出来 print $response;//加上后边这两句,也不报错、但是也没有数据打印出来 ?>
$s='{"total":359,"data":[{"Id":113023,"ProductId":2905,"ProductCode":"SZX01","ProductName":"计算机图书系列","ProcessDays":1,"ProcessResume":"","WorkDayPrice":79.0000,"WeekdayPrice":89.0000,"NormalPrice":0.0000,"Catalog":"0","Type":0,"RDCatalog":0,"BizCatalog":0,"StartDate":new Date(1350691200000),"Deleted":0},{"Id":113024,"TourId":2905,"ProductCode":"SZX01","ProductName":"儿童图书教系列","ProcessDays":1,"ProcessResume":"","WorkDayPrice":79.0000,"WeekdayPrice":89.0000,"NormalPrice":0.0000,"Catalog":"0","Type":0,"RDCatalog":0,"BizCatalog":0,"StartDate":new Date(1350777600000),"Deleted":0}]}'; $s=preg_replace('/new Date[^,]+/','"$0"',$s); print_r(json_decode($s)); /* stdClass Object ( [total] => 359 [data] => Array ( [0] => stdClass Object ( [Id] => 113023 [ProductId] => 2905 [ProductCode] => SZX01 [ProductName] => 计算机图书系列 [ProcessDays] => 1 [ProcessResume] => [WorkDayPrice] => 79 [WeekdayPrice] => 89 [NormalPrice] => 0 [Catalog] => 0 [Type] => 0 [RDCat