How to print something from a server with PHP? [closed]

自古美人都是妖i 提交于 2019-12-24 00:09:52

问题


I need to make my PHP application printing something using a printer connected to the server.

In PHP 4.0, php_printer.dll existed, but it was discontinued.

Does anyone have any idea or suggestion on how this could be done with PHP 5?


回答1:


You could write the output to a file and then use exec to print the file with the correct command (depending on the operating system).

Examples:

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

You would probably have to check if the php user has printing rights.



来源:https://stackoverflow.com/questions/15167207/how-to-print-something-from-a-server-with-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!