【发布时间】:2016-08-21 22:38:05
【问题描述】:
我正在尝试使用我的 Epson TM-T88IV 串行打印机使用 php 打印 QR 码。但是,我的 php 文件安装在服务器上,我可以从 html 文件中成功调用它。我正在使用一个名为 ESCPOS-PHP (https://github.com/mike42/escpos-php) 的库,并且计算机运行的是 Windows XP Professional。这是我的 php sn-p (中间还有更多,但打印操作不需要):
<?php
require __DIR__. '/escpos-php-master/Escpos.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
[...]
try {
$connector = new WindowsPrintConnector("EPSON TM-T88IV Receipt");
$printer = new Escpos($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
// Close printer
$printer -> close();
} catch(Exception $e) {
echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
}
?>
好像我只是无法连接到打印机。我也尝试过
$connector = new FilePrintConnector("/dev/ttyS0");
$printer = new Printer($connector);
这应该是串行打印机的方式(我不确定我应该放什么而不是“/dev/ttsyS0”)。也许我不应该尝试通过服务器触发它?我这样做是因为我无法修改他的 POS 系统 (Maitre D),而且我需要一种简单的方法来在账单上打印 QR 码。如果您知道任何工作,任何建议将不胜感激!谢谢
【问题讨论】:
-
windows xp 什么时候有了
/dev/ttyS0?那是unix主义。 -
我只是从 github 自述文件中给出的信息中获取的,我知道我必须添加其他内容,但我不知道具体是什么..