If you are an adventure and you are running PHP on a Windows system that uses CGI, ISAPI, or Apache modules, you can also get the COM function of the system. Now, it seems that the work of COM (Microsoft's Component Object Model) is left for Microsoft and if you are an adventurous, in addition, if you are running PHP on Windows systems that use CGI, ISAPI, or Apache modules, you can also obtain the COM function of the system. Now, it is explained that the work of COM (the Component Object Model of Microsoft) is left to Microsoft and those books with major titles. However, there is nothing wrong with dot COM. Below is a small snippet of common code (for example, it is common.
This code snippets use PHP to start Microsoft Word in the background, open a new file, key some text, keep the file, and then close the exploitation program:
// Create a reference to a new COM component (Word)
$ Word = new COM ('Word. application') or die ('Can't start word! ');
// Print the version of Word that's now in use
Echo 'loading Word, v. {$ word-> Version}
';
// Set the visibility of the application to 0 (false)
// To open the application in the forefront, use 1 (true)
$ Word-> Visible = 0;
// Create a new document in Word
$ Word-> Documents-> Add ();
// Add text to the new document
$ Word-> Selection-> TypeText ('testing 1-2-3 ...');
// Save the document in the Windows temp directory
$ Word-> Documents [1]-> SaveAs ('/Windows/temp/comtest.doc ');
// Close the connection to the COM component
$ Word-> Quit ();
// Print another message to the screen
Echo 'Check for the file ...';
?>
Assume that you are running an intranet Web site that stores data in the Microsoft SQL Server database. your users need Excel data. Then, you can let PHP perform necessary SQL queries and output results in a pattern. Then, use COM to start Excel and transmit data to it, finally, the file is stored in the user's desktop system.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service