遇到的问题一: $req = new WaimaiOrderIndexGetRequest; $req -setPageSize(100 ); $req -setPageNo(1 ); $req -setOrderStatus(21 ); $resp = $c -execute( $req , $sessionKey ); $resp =json_encode( $resp ); $content =json_decode( $resp ); json_dec
遇到的问题一:
<span>$req</span> = <span>new</span><span> WaimaiOrderIndexGetRequest; </span><span>$req</span>->setPageSize(100<span>); </span><span>$req</span>->setPageNo(1<span>); </span><span>$req</span>->setOrderStatus(21<span>); </span><span>$resp</span> = <span>$c</span>->execute(<span>$req</span>, <span>$sessionKey</span><span>); </span><span>$resp</span> =json_encode(<span>$resp</span><span>); </span><span>$content</span>=json_decode(<span>$resp</span>);
json_decode int 数据显示 E+14
参考http://denghai260.blog.163.com/blog/static/7268640920123280110590/
<span>foreach</span>(<span>$content</span>->result->result_list->takeout_third_order <span>as</span> <span>$key</span><span>) { </span><span>echo</span> '<a>'.<span>number_format</span>(<span>$key</span>->id, 0, '', '').<span>PHP_EOL</span>.'</a><br>'<span>; }</span>
这个是主要代码number_format($key->id, 0, '', '').PHP_EOL
注意:
这个number_format函数不能解决~~丢失了一些精度
所以这个的解决方案才是好的!
<span>php </span><span>$json</span> = '12345678901234567890'<span>; </span><span>var_dump</span>(json_decode(<span>$json</span><span>)); </span><span>var_dump</span>(json_decode(<span>$json</span>, <span>false</span>, 512,<span> JSON_BIGINT_AS_STRING)); </span>?><span> 以上例程会输出: </span><span>float</span>(1.2345678901235E+19<span>) </span><span>string</span>(20) "12345678901234567890"
随便说一下 博客园发布的瞬间就被抓取了~ 链接都去掉了 很不道德吧?
http://bbs.csdn.net/topics/390493074
编码问题:
PHP5.4版本,已经给Json新增了一个选项: JSON_UNESCAPED_UNICODE。加上这个选项后,就不会自动把中文编码了。
echo json_encode("厦门", JSON_UNESCAPED_UNICODE);
http://www.9enjoy.com/json_encode_zhongwen/
遇到的问题二:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
将自增字段设置为从0开始。
05:07:59 INSERT INTO `orderlist` (`order_id`,`store_id`) VALUES (`83xxxxx7194420 ` ,`2xxxxx`) Error Code: 1054. Unknown column '83xxxxx7194420 ' in 'field list' 0.000 sec
在mysql中的sql语句需要注意字段要加`, 具体的值不能加`!!切记 另外记得空格!
mysql更新时间出错的情况
http://blog.csdn.net/amohan/article/details/9980315