解决方案 »
- 帮忙看下echo输出html不正确为什么在"号前多了个\
- 急啊,在netbeans里xdebug怎么都配置不上
- linux上php安装连接mysql问题
- php如何调用WebServer提供的服务
- 这个提示是什么原因?关于oracle连接的问题
- 请教,这样的sql 语句是否必须写成荐储过程才可以取值.
- php+iis+sqlserver文章输出问题?请指教
- 关于安装php-4.3.2-Win32的问题。
- 吉鑫网络商店(php+mysql)修正版
- imagettftext()绝对路径也报错
- PHP 用继承 _contruct()出问题
- "ENTP" "ISTP"这2个字符串怎么单个字符进行比较?
"StartDate":new Date(1350691200000),
造成的,把它从字符串中都拿掉就可以了.你试试,我刚才调试过试验了.
$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
[RDCatalog] => 0
[BizCatalog] => 0
[StartDate] => new Date(1350691200000)
[Deleted] => 0
) [1] => stdClass Object
(
[Id] => 113024
[TourId] => 2905
[ProductCode] => SZX01
[ProductName] => 儿童图书教系列
[ProcessDays] => 1
[ProcessResume] =>
[WorkDayPrice] => 79
[WeekdayPrice] => 89
[NormalPrice] => 0
[Catalog] => 0
[Type] => 0
[RDCatalog] => 0
[BizCatalog] => 0
[StartDate] => new Date(1350777600000)
[Deleted] => 0
) ))
*/
加上双引号就可以了。$str = '{"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}]}';