PHP4 already supports Microsoft's COM technology. However, the documentation is rarely mentioned in the COM section.
Here are a few examples that I have tried. I hope these give you some idea. Note that these can only be run in 32-bit Microsoft
Under Windows platform.
Activating ADO with PHP
ADO is Microsoft's database object technology. ADO includes objects that connect to a database, and a Recordset object that returns data from a query statement and a Field object that displays data elements.
Many databases do not directly support ADO. A number of databases support a low level two Microsoft Database technology: ODBC and OLE DB. Many databases support ODBC; But OLE DB has a reputation for being faster than ODBC.
ADO is the API for wrapping ODBC and OLE DB.
This example opens a new ADO Connection object, opens a traditional Access database over ODBC, and then executes a SQL query that returns a Recordset object. Then we display the first three fields of the recordset.
?
$DBC = new COM ("ADODB. Connection ");
$dbc->provider = "MSDASQL";
$dbc->open ("Nwind");
$rs = $dbc->execute ("SELECT * FROM Products");
$i = 0;
while (! $rs->eof) {
$i + 1;
$FLD 0 = $rs->fields (0);
$FLD 1 = $rs->fields (1);
$FLD 2 = $rs->fields (2);
Print "$fld 0->value $fld 1->value $fld 2->value<br>";
$rs->movenext ();
}
$rs->close ();
?>
Calling Microsoft Word in PHP
This is another example:
?
$word =new COM ("Word.Application") or Die ("Cannot start Microsoft word");
Print "Loaded Word version ($word->version)";
$word->visible = 1;
$word->documents->add ();
$word->selection->typetext ("This is a Test");
?>
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.