问题
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