wsw / localx
与 Local X API 集成的客户端
dev-master
2014-12-04 00:49 UTC
Requires (Dev)
This package is auto-updated.
Last update: 2024-08-29 04:14:23 UTC
README
本地 X Web 服务 API 集成,适用于 PHP 5.3+,应使用兼容 PSR-4 的自动加载器。
安装
可以使用 Composer 安装此库。
基本示例
在本版本中可以管理
- 通过代码、描述、品牌或组(可以使用所有字段)搜索产品;
访问凭证
为了能够向 Web 服务发出请求,您必须配置访问凭证。
- 客户端代码(int)
- 秘密令牌(字符串)
<?php // Consideramos que já existe um autoloader compatível com a PSR-4 registrado use WSW\LocalX\Api; $Api = new Api('123456', '00000000000000000000000000000000');
搜索产品
在 Web 服务中执行产品搜索
<?php // Consideramos que já existe um autoloader compatível com a PSR-4 registrado use WSW\LocalX\Api; try { $api = new Api("00000", '00000000000000000000000000000000'); $search = array( 'codigo' => '018795-4', 'descricao' => 'FONTE SENTEY', 'marca' => 'SENTEY', 'grupo' => 'FONTES' ); $result = $api->find($search); var_dump(json_decode($result)); } catch (Exception $e) { echo $e->getMessage(); }
返回
返回的数据以 JSON 格式提供