Rumah >pembangunan bahagian belakang >tutorial php >UsingCOMwithPHP(我就不翻译了)_PHP教程

UsingCOMwithPHP(我就不翻译了)_PHP教程

WBOY
WBOYasal
2016-07-13 17:12:50866semak imbas

Using COM with PHP
     By John Lim.
PHP4 on Windows has been extended to support Microsoft's COM technology. However documentation on the COM functions is very sparse at the moment.
Here are some examples of stuff I have tried. Hope this gives you some ideas. Note that these only work when you are running PHP on a Windows Web server.
Active Data Objects (ADO) with PHP
ADO is Microsoft's database object technology. There are objects for connecting to databases, recordsets for data returned from queries, and field objects representing data elements.
Most databases do not support ADO directly. Instead most databases support 2 lower level Microsoft database technologies: ODBC and OLEDB. More databases support ODBC; but OLEDB has a reputation of being faster than ODBC.
ADO is then an API wrapper around ODBC and OLEDB.
This example opens a new ADO Connection object, opens the traditional NorthWind MS-Access database via ODBC. When we execute the SQL, a RecordSet object is returned. We then display the first 3 fields of the record-set.

    $dbc = new COM("ADODB.Connection");
    $dbc->Provider = "MSDASQL";
    $dbc->Open("nwind");
    $rs = $dbc->Execute("select * from products");
    $i = 0;
    $fld0 = $rs->Fields(0);
    $fld1 = $rs->Fields(1);
    $fld2 = $rs->Fields(2);
    while (!$rs->EOF) {
        $i += 1;
        print "$fld0->value $fld1->value $fld2->value
";
        $rs->MoveNext(); /*updates fld0, fld1, fld2 !*/
    }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629286.htmlTechArticleUsing COM with PHP By John Lim. PHP4 on Windows has been extended to support Microsoft's COM technology. However documentation on the COM functions is very sparse at the moment. Her...
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn