【问题标题】:prestashop webservices for image in json format用于 json 格式图像的 prestashop 网络服务
【发布时间】:2015-08-25 05:58:33
【问题描述】:

当我使用 XML 格式的 prestashop webservices 解析图像数据时,它可以正常工作,但是当我将输出格式更改为 JSON 时,它会出现错误。

XML 格式的结果是

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <image_types>
        <image_type id="7" name="category_default" xlink:href="http://abcd.com/api/image_types/7"/>
        <image_type id="3" name="medium_default" xlink:href="http://abcd.com/api/image_types/3"/>
    </image_types>
    <images>
        <image id="10" xlink:href="http://abcd.com/api/images/categories/10"/>
        <image id="11" xlink:href="http://abcd.com/api/images/categories/11"/>
        <image id="3" xlink:href="http://abcd.com/api/images/categories/3"/>
        <image id="4" xlink:href="http://abcd.com/api/images/categories/4"/>
        <image id="5" xlink:href="http://abcd.com/api/images/categories/5"/>
        <image id="6" xlink:href="http://abcd.com/api/images/categories/6"/>
        <image id="7" xlink:href="http://abcd.com/api/images/categories/7"/>
        <image id="8" xlink:href="http://abcd.com/api/images/categories/8"/>
        <image id="9" xlink:href="http://abcd.com/api/images/categories/9"/>
    </images>
</prestashop>

JSON 格式的结果是

{"":[{"id":"7"},{"id":"3"},{"id":"10"},{"id":"11"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"},{"id":"9"}],"errors":[{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."},{"code":null,"message":"Internal error. To see this error please display the PHP errors."}]}

【问题讨论】:

  • 在 JSON 与 XML 中获取图像时,我也看到了同样的问题

标签: json xml web-services


【解决方案1】:

使用它从 prestashop 网络服务获取图像

 <img src="http://abcd.com/api/images/products/{{product_id}}/{{image_id}}?ws_key=DS2FHJQQQSAG381PB52237254DVK9R14">

并从您的产品列表文件 xml/json 中获取您的产品 ID 和图像 ID。 把那个 id 放在那个图片 url 上,你就会得到你的图片

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多