POS 热敏打印机供应商文件
POS Thermal printer vendor file
我已经从 github https://github.com/mike42/escpos-php
下载了代码
<?php
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
$connector = new FilePrintConnector("/dev/usb/lp0");
$printer = new Printer($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
$printer -> close();
在此代码中缺少供应商目录
那将是 PHP Composer 功能。
A Dependency Manager for PHP
For libraries that specify autoload information, Composer generates a vendor/autoload.php file. You can simply include this file and start using the classes that those libraries provide without any extra work:
请参考上面链接的解释。
我已经从 github https://github.com/mike42/escpos-php
<?php
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
$connector = new FilePrintConnector("/dev/usb/lp0");
$printer = new Printer($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
$printer -> close();
在此代码中缺少供应商目录
那将是 PHP Composer 功能。
A Dependency Manager for PHP
For libraries that specify autoload information, Composer generates a vendor/autoload.php file. You can simply include this file and start using the classes that those libraries provide without any extra work:
请参考上面链接的解释。