If you like to take risks and run a CGI, ISAPI, or Apache version of PHP on Windows, you can access COM's functions. Well, the detailed explanation of the work of COM to Microsoft and many large books, in order to have a simple understanding of the functionality of COM, the following is a small common script.
This PHP script will start Microsoft Word processing software in the back-end of the system and open a new document, then enter some text, save the document and close Word. The specific procedures are as follows:
?
Establish an index to the new COM component
= new COM ("Word.Application") or Die ("Can ' t start word!");
Displays the version number of Word that is currently in use
echo "Loading Word, v. {->version}
";
Set its visibility to 0 (false), if you want it to open at the front end, use 1 (true)
To open the application in the forefront, use 1 (true)
->visible = 0;
Create a new document in Word
->documents->add ();
Add text to a new document
->selection->typetext ("Testing 1-2-3 ...");
Save the document in the Windows Temp directory
->documents[1]->saveas ("/windows/temp/comtest.doc");
Turn off connection to COM components
->quit ();
Display additional information on the screen
echo "Check for the file ...";
? >
If you have an intranet site where the data is stored in SQL Server and the user needs the Excel format for that data, we can have PHP run the necessary SQL queries and format the output, and then use COM to open Excel, Convert the data into Excel format data, and finally save the data on the user's desktop.
This is the ending of the Seminar on PHP. Hope that through this series of lectures, so that you have a preliminary understanding of PHP and understanding, in fact, we introduced is only the fur of PHP technology, our adventure has just begun, but as long as we can be full of enthusiasm and interest, believe that the near future, Everyone will be proficient in mastering PHP application development technology.