PHP4 already supports Microsoft's COM technology. However, in the documentation, the COM section is rarely mentioned.
Here are a few examples that I have tried. Hope these give you some ideas. Note that these can only run on 32-bit Microsoft
Under Windows platform.
Activating ADO with PHP
ADO is Microsoft's database object technology. ADO includes objects that connect to the database, Recordset objects that return data from query statements, and Field objects that represent data elements.
Many databases do not directly support ADO. This is because many databases support two levels of Microsoft Database technology: ODBC and OLE DB. Many databases support ODBC, but OLE DB has a faster reputation than ODBC.
ADO is an API that wraps ODBC and OLE DB.
This example opens a new ADO Connection object, opens a traditional Access database over ODBC, and then we execute the SQL query, which returns a Recordset object. We then show 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
";
$rs->movenext ();
}
$rs->close ();
?>
Call 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");
?>
http://www.bkjia.com/PHPjc/531898.html www.bkjia.com true http://www.bkjia.com/PHPjc/531898.html techarticle PHP4 already supports Microsoft's COM technology. However, in the documentation, the COM section is rarely mentioned. Here are a few examples that I have tried. Hope these give you some ideas. Note that these can only be shipped ...