Use PHP to operate the MACOS clipboard. Of course, this cannot be the B/S mode, which is used to operate the clipboard of the client proxy (the system of the browser. The B/S structure can only be operated using JAVASCRIPT or FLASH. for PHP, only the server can be operated. Here we will talk about it through... "> <LINKhref =" http://www.php100.com//stat
Use PHP to operate the MACOS clipboard. Of course, this cannot be the B/S mode, which is used to operate the clipboard of the client proxy (the system of the browser. The B/S structure can only be operated using JAVASCRIPT or FLASH. for PHP, only the server can be operated.
Here we will talk about the operation of the clipboard by calling pbcopy and pbpaste under the system MACOS.
Pbcopy takes the standard input and places it in the specified pasteboard. If no pasteboard is specified, the general pasteboard will be used by default. The input is
Placed in the pasteboard as plain text data unless it begins with the Encapsulated PostScript (EPS) file header or the Rich Text Format (RTF) file header, in which case
It is placed in the pasteboard as one of those data types.
Pbpaste removes the data from the pasteboard and writes it to the standard output. It normally looks first for plain text data in the pasteboard and writes that to
Standard output; if no plain text data is in the pasteboard it looks for Encapsulated PostScript; if no EPS is present it looks for Rich Text. If none of those types
Is present in the pasteboard, pbpaste produces no output.
Let's take a look at the simple example. Is it easy to use the exec function? Haha!
/**
* Read clipboard content
*/
Exec ('pbpaste ', $ output, $ return );
Var_dump ($ output, $ return );
/**
* Write content (go to clipboard) to the clipboard
*/
Exec ('echo go to clipboard | pbcopy', $ output, $ return );
Var_dump ($ output, $ return );