我有以下代码可以使其能够将某些内容打印到热敏收据打印机。使用PHP打印到热敏收据打印机使用PHP
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功能.... http://www.php.net/manual/en/function.printer-open.php – user1844933
它给我这:'调用未定义的函数printer_open()' – user3271851
嗯,只是一个猜测,你是否在你的实际代码中使用“fclose”? – Passerby