我正在实现用于打印发票的功能,因为我使用了Escpos模块,但是当我运行这个时没有响应。在Linux中使用PHP escpos打印发票
如果我打印php_sapi_name我得到了“apache2handler”而不是“cli”,我有linux系统。我不知道如何在我的网络服务器上获得“cli”。
能否请您分享您的想法的问题引述非常熟悉的前瞻性代码片段,我假设你是指mike42/escpos-php解决这个问题
if(php_sapi_name() == 'cli') {// i got apache2handler
$connector = new FilePrintConnector("php://stdout");
} else {
throw new InvalidArgumentException("Argument passed to Escpos::__construct() must implement interface PrintConnector, null given.");
}
如果我在Windows上安装USB打印机,该怎么传递给FilePrintConnector()。 –