cvs: phpdoc-zh /reference/classobj/functions call-user-method.xml
| From: | Krazy Nio | Date: | Sun, 30 Mar 2003 13:30:04 +0000 |
| Subject: | cvs: phpdoc-zh /reference/classobj/functions call-user-method.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1268@lists.php.net to get a copy of this message | ||
nio Sun Mar 30 08:30:04 2003 EDT
Added files:
/phpdoc-zh/reference/classobj/functions call-user-method.xml
Log:
Add file
Index: phpdoc-zh/reference/classobj/functions/call-user-method.xml
+++ phpdoc-zh/reference/classobj/functions/call-user-method.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: nio $ -->
<!-- EN-Revision: 1.4 Maintainer: nio Status: ready -->
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
<refentry id="function.call-user-method">
<refnamediv>
<refname>call_user_method</refname>
<refpurpose>
µ÷ÓÃÌØ¶¨¶ÔÏóµÄÓû§·½·¨£ÛÒÑÍ£ÓãÝ
</refpurpose>
</refnamediv>
<refsect1>
<title>ÃèÊö</title>
<methodsynopsis>
<type>mixed</type><methodname>call_user_method</methodname>
<methodparam><type>string</type><parameter>method_name</parameter></methodparam>
<methodparam><type>object</type><parameter>obj</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>parameter</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<warning>
<para>
<function>call_user_method</function>
º¯Êý´Ó PHP 4.1.0 ¿ªÊ¼ÒѾͣÓã¬Ê¹ÓÃ
<function>call_user_func</function>
º¯ÊýºÍ <literal>array(&$obj, "method_name")</literal>
Óï·¨´úÌæ¡£
</para>
</warning>
<para>
´ÓÓû§¶¨ÒåµÄ <parameter>obj</parameter>
¶ÔÏóÖе÷Óà <parameter>method_name</parameter>
ËùÖ¸µÄ·½·¨¡£Ï±ßÊÇÓ÷¨Ê¾Àý£¬ÎÒÃǶ¨ÒåÁËÒ»¸öÀ࣬½Ó×Å´´½¨ÁËÒ»¸ö¶ÔÏóʵÀý£¬È»ºóʹÓÃ
<function>call_user_method</function> ¼ä½Óµ÷ÓÃËüµÄ
<varname>print_info</varname> ·½·¨¡£
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
class Country {
var $NAME;
var $TLD;
function Country($name, $tld) {
$this->NAME = $name;
$this->TLD = $tld;
}
function print_info($prestr="") {
echo $prestr."Country: ".$this->NAME."\n";
echo $prestr."Top Level Domain: ".$this->TLD."\n";
}
}
$cntry = new Country("Peru","pe");
echo "* Calling the object method directly\n";
$cntry->print_info();
echo "\n* Calling the same method indirectly\n";
call_user_method ("print_info", $cntry, "\t");
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
²Î¼û <function>call_user_func_array</function>¡¢
<function>call_user_func</function> ºÍ
<function>call_user_method_array</function>¡£
</simpara>
</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
-->