10 tips for acronisdiskdirector10 PHP scripts 6

Source: Internet
Author: User
PHP and COM
If you're an adventurer and you're running PHP on a CGI, ISAPI, or Apache version of the Windows system, you can also get the COM functionality of the system. Now, the work of explaining COM (the Component Object model of Microsoft) is left to Microsoft and those voluminous books to complete. However, there is nothing wrong with knowing dot com, there is a common (no pun, for very ordinary) code small fragment.
This little snippet of code uses PHP to start Microsoft Word in the background, open a new file, type some text, save the file, and then close the application:
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 ' s now
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 ...");
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 ...";
?>
Suppose you are running an intranet Web site that stores data in a Microsoft SQL server database, and your users need data in Excel format. So, you can have PHP execute the necessary SQL queries and format the output, then use COM to start Excel, transfer the data to it, and then store the files in the user's desktop system.

The above describes the Acronisdiskdirector10 PHP script 10 tips 6, including the acronisdiskdirector10 aspect of the content, I hope that the PHP tutorial interested in a friend to help.

  • 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.