PHP code example of wosh / xpyun-sdk
1. Go to this page and download the library: Download wosh/xpyun-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wosh / xpyun-sdk example snippets
//composer下加载方式
lude_once __DIR__ . "src/Lib/Autoloader.php";
//初始化配置
use Wosh\Config\XpyConfig;
$config = new XpyConfig('你的应用账号,即用户名/注册邮箱', '你的应用密钥');
//授权打印机(他加过请跳过该步骤)
use Wosh\Api\PrinterService;
$printer = new PrinterService($config);
$data = $printer->addPrinter('打印机编号', '打印机名字', '打印机识别码', '流量卡号码');
var_dump($data);
//调取文本打印
use Wosh\Api\PrintService;
$print = new PrintService($config);
$data = $print->index('打印机编号','打印内容排版可看Demo下的callback.php','打印次数');
var_dump($data);
PHP >= 5.4