PHP End Story: Continuing the Adventure

Source: Internet
Author: User
Tags php and php script

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.




Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.