【发布时间】:2014-02-07 04:24:12
【问题描述】:
我有以下代码,它应该能够在热敏收据打印机上打印一些东西。
if ($_GET['action'] == 'print')
{
$printer = "\\\\localhost\\zebra";
// Open connection to the thermal printer
$fp = fopen($printer, "w");
if (!$fp){
die('no connection');
}
$data = " PRINT THIS ";
// Cut Paper
$data .= "\x00\x1Bi\x00";
if (!fwrite($fp,$data)){
die('writing failed');
}
}
虽然,当我运行它时,什么也没有发生,也没有错误。如何从 PHP 打印?
【问题讨论】:
-
使用printer_open函数怎么样....php.net/manual/en/function.printer-open.php
-
它给了我这个:
Call to undefined function printer_open() -
嗯,只是猜测,你
fclose你的实际代码吗? -
尊敬的@user3271851,您找到解决方案了吗?如果您有解决方案,请帮助。谢谢。