接入淘宝API(PHP版本)

本文链接! http://www.cnblogs.com/MicroHao/p/4030117.html

遇到的问题一:

   

     $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_decode int 数据显示 E+14 

参考http://denghai260.blog.163.com/blog/static/7268640920123280110590/

    foreach($content->result->result_list->takeout_third_order as $key)
    { 
         echo '<a>'.number_format($key->id, 0, '', '').PHP_EOL.'</a><br/>';
    }

这个是主要代码number_format($key->id, 0, '', '').PHP_EOL

注意:

 这个number_format函数不能解决~~丢失了一些精度

 所以这个的解决方案才是好的!
<?php
$json = '12345678901234567890';
 
var_dump(json_decode($json));
var_dump(json_decode($json, false, 512, JSON_BIGINT_AS_STRING));
 
?>
 
以上例程会输出:
float(1.2345678901235E+19)
string(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更新时间出错的情况

Error Code: 1175 You are using safe update mode and you tried to update a table without a WHERE that

http://blog.csdn.net/amohan/article/details/9980315

原文地址:https://www.cnblogs.com/MicroHao/p/4030117.html