如何使用PHP从服务器打印东西?

时间:2013-03-01 21:31:15

标签: php printing

我需要让我的PHP应用程序使用连接到服务器的打印机打印一些内容。

在PHP 4.0中,php_printer.dll已存在,但已停止使用。

有没有人对如何使用PHP 5做任何想法或建议?

1 个答案:

答案 0 :(得分:2)

您可以将输出写入文件,然后使用exec使用正确的命令打印文件(取决于操作系统)。

示例:

exec('lpr /some/path/to/the/file', $output);    // linux
exec('print C:\again\a\path', $output);         // windows

您可能需要检查php用户是否具有打印权限。