mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-24 04:48:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78496 c90b9560-bf6c-de11-be94-00142212c4b1
155 lines
4 KiB
XML
155 lines
4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<!-- splitted from ./en/functions/com.xml, last change in rev 1.12 -->
|
|
<refentry id="class.com">
|
|
<refnamediv>
|
|
<refname>COM</refname>
|
|
<refpurpose>COM class</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv>
|
|
<synopsis>$obj = new <classname>COM</classname>("server.object")</synopsis>
|
|
</refsynopsisdiv>
|
|
<refsect1 id="class.com.class">
|
|
<title>Description</title>
|
|
<simpara>
|
|
The COM class provides a framework to integrate (D)COM components into
|
|
your php scripts.
|
|
</simpara>
|
|
</refsect1>
|
|
<refsect1 id="class.com.constructor">
|
|
<title>Methods</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>COM::COM</methodname>
|
|
<methodparam><type>string</type><parameter>module_name</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>server_name</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>codepage</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
COM class constructor. Parameters:
|
|
<variablelist>
|
|
<varlistentry><term>module_name</term>
|
|
<listitem>
|
|
<simpara>
|
|
name or class-id of the requested component.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>server_name</term>
|
|
<listitem>
|
|
<simpara>
|
|
name of the DCOM server from which the component should be fetched.
|
|
If &null;, <literal>localhost</literal> is assumed.
|
|
To allow DCOM <constant>com.allow_dcom</constant> has to be set to
|
|
&true; in &php.ini;.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>codepage</term>
|
|
<listitem>
|
|
<simpara>
|
|
specifies the codepage that is used to convert php-strings to
|
|
unicode-strings and vice versa. Possible values are
|
|
<constant>CP_ACP</constant>, <constant>CP_MACCP</constant>,
|
|
<constant>CP_OEMCP</constant>, <constant>CP_SYMBOL</constant>,
|
|
<constant>CP_THREAD_ACP</constant>, <constant>CP_UTF7</constant>
|
|
and <constant>CP_UTF8</constant>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
<para>
|
|
<example id="example.com1">
|
|
<title>COM example (1)</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
// starting word
|
|
$word = new COM("word.application") or die("Unable to instanciate Word");
|
|
print "Loaded Word, version {$word->Version}\n";
|
|
|
|
//bring it to front
|
|
$word->Visible = 1;
|
|
|
|
//open an empty document
|
|
$word->Documents->Add();
|
|
|
|
//do some weird stuff
|
|
$word->Selection->TypeText("This is a test...");
|
|
$word->Documents[1]->SaveAs("Useless test.doc");
|
|
|
|
//closing word
|
|
$word->Quit();
|
|
|
|
//free the object
|
|
$word->Release();
|
|
$word = null;
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example id="example.com2">
|
|
<title>COM example (2)</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
|
|
$conn->Open("Provider=SQLOLEDB; Data Source=localhost;
|
|
Initial Catalog=database; User ID=user; Password=password");
|
|
|
|
$rs = $conn->Execute("SELECT * FROM sometable"); // Recordset
|
|
|
|
$num_columns = $rs->Fields->Count();
|
|
echo $num_columns . "\n";
|
|
|
|
for ($i=0; $i < $num_columns; $i++)
|
|
{
|
|
$fld[$i] = $rs->Fields($i);
|
|
}
|
|
|
|
$rowcount = 0;
|
|
while (!$rs->EOF)
|
|
{
|
|
for ($i=0; $i < $num_columns; $i++)
|
|
{
|
|
echo $fld[$i]->value . "\t";
|
|
}
|
|
echo "\n";
|
|
$rowcount++; // increments rowcount
|
|
$rs->MoveNext();
|
|
}
|
|
|
|
$rs->Close();
|
|
$conn->Close();
|
|
|
|
$rs->Release();
|
|
$conn->Release();
|
|
|
|
$rs = null;
|
|
$conn = null;
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|