cvs: phpdoc-zh /reference/classobj/functions get-class-vars.xml get-class.xml

From: Date: Fri, 16 Dec 2005 03:17:56 +0000
Subject: cvs: phpdoc-zh /reference/classobj/functions get-class-vars.xml get-class.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-2720@lists.php.net to get a copy of this message
dallas Fri Dec 16 03:17:56 2005 EDT Modified files: /phpdoc-zh/reference/classobj/functions get-class-vars.xml get-class.xml Log: Updated. http://cvs.php.net/viewcvs.cgi/phpdoc-zh/reference/classobj/functions/get-class-vars.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-zh/reference/classobj/functions/get-class-vars.xml diff -u phpdoc-zh/reference/classobj/functions/get-class-vars.xml:1.1 phpdoc-zh/reference/classobj/functions/get-class-vars.xml:1.2 --- phpdoc-zh/reference/classobj/functions/get-class-vars.xml:1.1 Mon Mar 31 14:35:06 2003 +++ phpdoc-zh/reference/classobj/functions/get-class-vars.xml Fri Dec 16 03:17:56 2005 @@ -1,35 +1,33 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> -<!-- $Author: nio $ --> -<!-- EN-Revision: 1.4 Maintainer: nio Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- $Author: dallas $ --> +<!-- EN-Revision: 1.9 Maintainer: nio Status: ready --> <!-- splitted from ./en/functions/classobj.xml, last change in rev 1.1 --> - <refentry id="function.get-class-vars"> - <refnamediv> - <refname>get_class_vars</refname> - <refpurpose> - ·µ»ØÓÉÀàµÄĬÈÏÊôÐÔ×é³ÉµÄÊý×é - </refpurpose> - </refnamediv> - <refsect1> - <title>ÃèÊö</title> - <methodsynopsis> - <type>array</type><methodname>get_class_vars</methodname> - <methodparam><type>string</type><parameter>class_name</parameter></methodparam> - </methodsynopsis> - <para> - ·µ»ØÓÉÀàµÄĬÈÏÊôÐÔ×é³ÉµÄ¹ØÁªÊý×飬´ËÊý×éµÄÔªËØÒÔ - <parameter>varname => value</parameter> µÄÐÎʽ´æÔÚ¡£ - </para> - <note> - <para> - ÔÚ PHP 4.2.0 ֮ǰ£¬<function>get_class_vars</function> - ²»»á°üº¬Î´³õʼ»¯µÄÀà±äÁ¿¡£ - </para> - </note> - <para> - <example> - <title><function>get_class_vars</function> ʾÀý</title> - <programlisting role="php"> +<refentry id="function.get-class-vars"> + <refnamediv> + <refname>get_class_vars</refname> + <refpurpose>·µ»ØÓÉÀàµÄĬÈÏÊôÐÔ×é³ÉµÄÊý×é</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>array</type><methodname>get_class_vars</methodname> + <methodparam><type>string</type><parameter>class_name</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»ØÓÉÀàµÄĬÈϹ«ÓÐÊôÐÔ×é³ÉµÄ¹ØÁªÊý×飬´ËÊý×éµÄÔªËØÒÔ + <parameter>varname => value</parameter> µÄÐÎʽ´æÔÚ¡£ + </para> + <note> + <para> + ÔÚ PHP 4.2.0 ֮ǰ£¬<function>get_class_vars</function> + ²»»á°üº¬Î´³õʼ»¯µÄÀà±äÁ¿¡£ + </para> + </note> + <para> + <example> + <title><function>get_class_vars</function> ʾÀý</title> + <programlisting role="php"> <![CDATA[ <?php @@ -38,10 +36,14 @@ var $var1; // ´Ë±äÁ¿Ã»ÓÐĬÈÏÖµ¡­¡­ var $var2 = "xyz"; var $var3 = 100; - + private $var4; // PHP 5 + // constructor function myclass() { - return(TRUE); + // change some properties + $this->var1 = "foo"; + $this->var2 = "bar"; + return true; } } @@ -56,13 +58,9 @@ ?> ]]> - </programlisting> - </example> - </para> - <para> - ÔËÐнá¹û£º - <informalexample> - <programlisting> + </programlisting> + &example.outputs; + <screen> <![CDATA[ // ÔÚ PHP 4.2.0 ֮ǰ var2 : xyz @@ -73,15 +71,15 @@ var2 : xyz var3 : 100 ]]> - </programlisting> - </informalexample> - </para> - <simpara> - ²Î¼û <function>get_class_methods</function>¡¢ - <function>get_object_vars</function> - </simpara> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + ²Î¼û <function>get_class_methods</function>¡¢ + <function>get_object_vars</function> + </simpara> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewcvs.cgi/phpdoc-zh/reference/classobj/functions/get-class.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-zh/reference/classobj/functions/get-class.xml diff -u phpdoc-zh/reference/classobj/functions/get-class.xml:1.1 phpdoc-zh/reference/classobj/functions/get-class.xml:1.2 --- phpdoc-zh/reference/classobj/functions/get-class.xml:1.1 Mon Mar 31 14:53:10 2003 +++ phpdoc-zh/reference/classobj/functions/get-class.xml Fri Dec 16 03:17:56 2005 @@ -1,37 +1,84 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> -<!-- $Author: nio $ --> -<!-- EN-Revision: 1.2 Maintainer: nio Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- $Author: dallas $ --> +<!-- EN-Revision: 1.8 Maintainer: nio Status: ready --> <!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 --> - <refentry id="function.get-class"> - <refnamediv> - <refname>get_class</refname> - <refpurpose>·µ»Ø¶ÔÏóµÄÀàÃû</refpurpose> - </refnamediv> - <refsect1> - <title>ÃèÊö</title> - <methodsynopsis> - <type>string</type><methodname>get_class</methodname> - <methodparam><type>object</type><parameter>obj</parameter></methodparam> - </methodsynopsis> - <para> - ·µ»Ø¶ÔÏóʵÀý <parameter>obj</parameter> - ËùÊôÀàµÄÃû×Ö¡£Èç¹û <parameter>obj</parameter> - ²»ÊÇÒ»¸ö¶ÔÏóÔò·µ»Ø &false;¡£ - </para> - <note> - <simpara> - <function>get_class</function> ·µ»ØÓû§¶¨ÒåµÄÀàÃûµÄСдÐÎʽ¡£ÔÚ - PHP À©Õ¹Öж¨ÒåµÄÀàÔò·µ»ØÆäÔ­ÓеÄÃû×Ö¡£ - </simpara> - </note> - <simpara> - ²Î¼û <function>get_parent_class</function>¡¢ - <function>gettype</function> ºÍ - <function>is_subclass_of</function>¡£ - </simpara> - </refsect1> - </refentry> +<refentry id="function.get-class"> + <refnamediv> + <refname>get_class</refname> + <refpurpose>·µ»Ø¶ÔÏóµÄÀàÃû</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>get_class</methodname> + <methodparam choice="opt"><type>object</type><parameter>obj</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»Ø¶ÔÏóʵÀý <parameter>obj</parameter> + ËùÊôÀàµÄÃû×Ö¡£Èç¹û <parameter>obj</parameter> + ²»ÊÇÒ»¸ö¶ÔÏóÔò·µ»Ø &false;¡£ + </para> + <note> + <simpara> + ÔÚ PHP À©Õ¹¿âÖж¨ÒåµÄÀà·µ»ØÆäԭʼ¶¨ÒåµÄÃû×Ö¡£ÔÚ PHP 4 ÖÐ + <function>get_class</function> ·µ»ØÓû§¶¨ÒåµÄÀàÃûµÄСдÐÎʽ£¬µ«ÊÇÔÚ + PHP 5 Öн«·µ»ØÀàÃû¶¨ÒåʱµÄÃû×Ö£¬ÈçͬÀ©Õ¹¿âÖеÄÀàÃûÒ»Ñù¡£ + </simpara> + </note> + <note> + <para> + ×Ô PHP 5 Æð£¬Èç¹ûÔÚ¶ÔÏóµÄ·½·¨Öе÷ÓÃÔò + <parameter>obj</parameter> Ϊ¿ÉÑ¡Ïî¡£ + </para> + </note> + <para> + <example> + <title>ʹÓà <function>get_class</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + +class foo { + function foo() + { + // implements some logic + } + + function name() + { + echo "My name is " , get_class($this) , "\n"; + } +} + +// create an object +$bar = new foo(); + +// external call +echo "Its name is " , get_class($bar) , "\n"; + +// internal call +$bar->name(); + +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Its name is foo +My name is foo +]]> + </screen> + </example> + </para> + <para> + ²Î¼û <function>get_parent_class</function>¡¢ + <function>gettype</function> ºÍ + <function>is_subclass_of</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables:

« previous php.doc.zh (#2720) next »