Giter VIP home page Giter VIP logo

kuaidi100-api / php-demo Goto Github PK

View Code? Open in Web Editor NEW
106.0 4.0 20.0 106 KB

快递100php快递查询接口-此php接口目录内容包括:对接快递电子面单制作和打印接口、 快递公司寄件接口、快递公司物流轨迹地图接口、包裹到达和派件时间预估接口、实时查询物流状态接口和订阅物流状态提醒接口。php快递查询接口示例仅用于展示快递100物流查询接口的对接流程,其中的API密钥需要注册获取,您可点击下方官网链接申请免费接口,如果需要人工帮助,可以咨询快递100API官网运营,此服务不收取任何费用。

PHP 100.00%
tracking-api shipping-api shipping-label php php-library labeling-tool kuaidi100api kuaidi100 demo

php-demo's Issues

关于接口返回值的转义处理 str_replace("\"", '"', $result);

我想讨论的代码在当前示例的这个中

src/synquery.php: 43

上下文大概是这样

    $result = curl_exec($ch);
    $data = str_replace("\"", '"', $result );
    $data = json_decode($data);

我认为这步 replace 是没有意义的。我理解,原本这部替换,是希望把类似于这种字符串 \"128\" 变成这样 "128"。如果是这个需求的话,这行应该写成这样:

    $data = str_replace('\"', '"', $result );    // 第一个参数改为使用单引号

根据我测试,kuaidi100 的接口,并不会返回 \"128\" 的数据,所以可以没有这步替换。

这其中的细节大概是这样的,在 php 中,双引号和单引号的意义不完全相同。双引号会转义字符串,将 \" 理解成一个字符(双引号)。但是单引号不会转移字符串,会将 \" 理解成两个字符(一个斜杠和一个双引号)。

顺便现在已有代码不影响针对该接口的正常使用,我就随便聊聊。

...

啊啊啊

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.