【发布时间】:2016-01-23 10:51:10
【问题描述】:
我正在实现打印发票的功能,为此我使用了 Escpos 模块,但是当我运行它时没有响应。
如果我打印 php_sapi_name 我得到的是“apache2handler”而不是“cli”,我有 linux 系统。我不知道如何在我的网络服务器中获取“cli”。
您能否分享您解决此问题的想法
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.");
}
【问题讨论】:
标签: php printing command-line-interface escpos