mirror of
https://github.com/php/doc-it.git
synced 2026-03-27 09:02:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@78500 c90b9560-bf6c-de11-be94-00142212c4b1
158 lines
4.3 KiB
XML
158 lines
4.3 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- splitted from ./it/functions/com.xml, last change in rev 1.7 -->
|
|
<!-- last change to 'class.com' in en/ tree in rev 1.12 -->
|
|
<!-- EN-Revision: 1.2 Maintainer: cucinato Status: ready -->
|
|
<!-- OLD-Revision: 1.32/EN.1.12 -->
|
|
<refentry id="class.com">
|
|
<refnamediv>
|
|
<refname>COM</refname>
|
|
<refpurpose>classe COM</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv>
|
|
<synopsis>$obj = new <classname>COM</classname>("server.object")</synopsis>
|
|
</refsynopsisdiv>
|
|
<refsect1 id="class.com.class">
|
|
<title>Descrizione</title>
|
|
<simpara>
|
|
La classe COM fornisce un ambiente per integrare (D)COM components
|
|
negli script php.
|
|
</simpara>
|
|
</refsect1>
|
|
<refsect1 id="class.com.constructor">
|
|
<title>Metodi</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>COM::COM</methodname>
|
|
<methodparam><type>string</type><parameter>nome_modulo</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>nome_server</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>codepage</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
costruttore della classe COM. Parametri:
|
|
<variablelist>
|
|
<varlistentry><term>nome_modulo</term>
|
|
<listitem>
|
|
<simpara>
|
|
nome o class-id del componente desiderato.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>nome_server</term>
|
|
<listitem>
|
|
<simpara>
|
|
nome del server DCOM dal quale deve essere richiamato il componente.
|
|
Se &null;, si assume <literal>localhost</literal>.
|
|
Per permettere l'uso di DCOM il parametro <constant>com.allow_dcom</constant> deve essere impostato a
|
|
&true; in &php.ini;.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>codepage</term>
|
|
<listitem>
|
|
<simpara>
|
|
specifica la codepage che verrà usata per convertire le stringhe di PHP in
|
|
stringhe Unicode e viceversa. I valori possibili sono
|
|
<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>
|
|
e <constant>CP_UTF8</constant>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
<para>
|
|
<example id="example.com1">
|
|
<title>esempio di COM (1)</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
// esecuzione di Word
|
|
$word = new COM("word.application") or die("Non sono riuscito ad eseguire Word");
|
|
print "Word caricato, versione {$word->Version}\n";
|
|
|
|
//lo porta in primo piano
|
|
$word->Visible = 1;
|
|
|
|
//apre un documento vuoto
|
|
$word->Documents->Add();
|
|
|
|
//esegue un po' di operazioni inutili
|
|
$word->Selection->TypeText("Questa è una prova...");
|
|
$word->Documents[1]->SaveAs("Prova inutile.doc");
|
|
|
|
//chiude Word
|
|
$word->Quit();
|
|
|
|
//libera l'oggetto
|
|
$word->Release();
|
|
$word = null;
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example id="example.com2">
|
|
<title>esempio di COM (2)</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$conn = new COM("ADODB.Connection") or die("non riesco ad attivare ADO");
|
|
$conn->Open("Provider=SQLOLEDB; Data Source=localhost;
|
|
Initial Catalog=database; User ID=user; Password=password");
|
|
|
|
$rs = $conn->Execute("SELECT * FROM unatabella"); // Recordset
|
|
|
|
$num_colonne = $rs->Fields->Count();
|
|
echo $num_columns . "\n";
|
|
|
|
for ($i=0; $i < $num_colonne; $i++)
|
|
{
|
|
$campi[$i] = $rs->Fields($i);
|
|
}
|
|
|
|
$contorighe = 0;
|
|
while (!$rs->EOF)
|
|
{
|
|
for ($i=0; $i < $num_colonne; $i++)
|
|
{
|
|
echo $campi[$i]->value . "\t";
|
|
}
|
|
echo "\n";
|
|
$contorighe++; // incrementa contorighe
|
|
$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
|
|
-->
|