【问题标题】:Printing webpage generated by php using 2Printer Command Line tool使用 2Printer 命令行工具打印 php 生成的网页
【发布时间】:2018-04-11 03:53:40
【问题描述】:
我正在尝试使用来自fcoder.zendesk.com 的2Printer(免费版)打印 php 生成的页面。我使用以下代码来完成任务:
<?php
exec("2Printer.exe -s 'text.php' -alert_no");
//shell_exec("2Printer.exe -s 'text.php' -alert_no");
//system("2Printer.exe -s 'text.php' -alert_no");
以上代码均不起作用,也不会输出任何错误。我用文本文件 (.txt) 尝试过,但它仍然无法正常工作。但是从正常的命令窗口(cmd),打印工作正常。有没有人有2printer的经验,请帮忙。
【问题讨论】:
标签:
php
command-line
printing
command
【解决方案1】:
1) 请确保您的源文件夹和打印机可以从您调用 2Printer 的帐户访问。
2) 仅供实验,请尝试调用2Printer打印JPEG或PNG图像文件。
【解决方案2】:
同样的问题。
- 我注意到您缺少一些引号
- 将 2>&1 添加到您的字符串以获取详细的错误消息。
exec("2Printer.exe -s 'text.php' '-alert_no' 2>&1",$output);
var_dump($output);
我总是得到:
Der Befehl "2Printer" ist entweder falsch geschrieben oder konnte
nicht gefunden werden。
它不知道命令:“2Printer”,即使使用“2Printer.exe”也无法正常工作。 :(