mirror of
https://github.com/php/doc-ja.git
synced 2026-03-31 03:22:07 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@199997 c90b9560-bf6c-de11-be94-00142212c4b1
116 lines
2.8 KiB
XML
116 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.8 $ -->
|
|
<!-- EN-Revision: 1.11 Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: shimooka,takagi -->
|
|
<refentry id="function.get-class-methods">
|
|
<refnamediv>
|
|
<refname>get_class_methods</refname>
|
|
<refpurpose>クラスメソッドの名前を連想配列として返す</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>説明</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>get_class_methods</methodname>
|
|
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
この関数は、指定したクラス<parameter>class_name</parameter>に
|
|
ついてメソッドの名前を連想配列として返します。
|
|
エラー時には &null; を返します。
|
|
</para>
|
|
<note>
|
|
<para>
|
|
PHP 4.0.6 以降では、<parameter>class_name</parameter> の替わりに
|
|
オブジェクト自身を指定することが可能です。例えば、
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$class_methods = get_class_methods($my_class); // 全ての例は下を見てください。
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>get_class_methods</function>の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
class myclass {
|
|
// コンストラクタ
|
|
function myclass()
|
|
{
|
|
return(true);
|
|
}
|
|
|
|
// メソッド1
|
|
function myfunc1()
|
|
{
|
|
return(true);
|
|
}
|
|
|
|
// メソッド2
|
|
function myfunc2()
|
|
{
|
|
return(true);
|
|
}
|
|
}
|
|
|
|
$class_methods = get_class_methods('my_object');
|
|
|
|
foreach ($class_methods as $method_name) {
|
|
echo "$method_name\n";
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
myclass
|
|
myfunc1
|
|
myfunc2
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<warning>
|
|
<para>
|
|
PHP 5 以降、この関数は宣言されているままのメソッド名
|
|
(大文字小文字を区別) を返します。PHP 4 では、小文字で返されます。
|
|
</para>
|
|
</warning>
|
|
<simpara>
|
|
<function>get_class</function>、
|
|
<function>get_class_vars</function> および
|
|
<function>get_object_vars</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
|
|
-->
|