我正在實現用於打印發票的功能,因爲我使用了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()。 –