翻页报错can't parse to JSON

2016-07-07 15:01 来源:www.chinab4c.com 作者:ecshop专家

你使用是什么浏览器?
文件是否进行过修改

初步判断可能是编码问题

回答:


使用火狐,php文件修改过,js文件没有修改

在很多页面添加购物按钮后,点击时会出现例外被抛出,根据我的错误提示
uncaught exception: [Exception... "'transport.js/parseResult() error: can't parse to JSON. <br /> <b>Warning</b>: number_format() expects parameter 1 to be double, string given in <b>D:\wamp\www\ecshop\includes\lib_common.php</b> on line <b>965</b><br /> {"error":6,"message":[{"attr_type":"1","name":"\u989c\u8272","attr_id":"185","values":[{"label":"\u9ed1\u8272","price":"","format_price":"\uffe5\u5143","id":"196"},{"label":"\u91d1\u8272","price":"10","format_price":"\uffe510.00\u5143","id":"197"},{"label":"\u767d\u8272","price":"20","format_price":"\uffe520.00\u5143","id":"198"}]}],"content":"","goods_id":"19","parent":0}' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: chrome://firebug/content/spy.js :: callPageHandler :: line 744" data: no]

找到\includes\lib_common.php下的964行
$price = number_format($price,2, '.', '');
改成
//$price = number_format((double)$price,2, '.', '');即可
希望对你有帮助

很好,谢谢!