1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-25 07:32:10 +01:00
Files
魔王卷子 e074ab5ee7 Update reflection 3 (#650)
* Update getclass.xml

* Update isdefaultvalueavailable.xml

* Delete tostring.xml

* Update getname.xml

* Update isbuiltin.xml

* Update construct.xml

* Update export.xml

* Update getclosure.xml

* Update getdeclaringclass.xml

* Update getmodifiers.xml

* Update getprototype.xml

* Update invoke.xml

* Update invokeargs.xml

* Update isabstract.xml

* Update isconstructor.xml

* Update isdestructor.xml

* Update isfinal.xml

* Update isprivate.xml

* Update isprotected.xml

* Update ispublic.xml

* Update isstatic.xml

* Update setaccessible.xml

* Update tostring.xml

* Update reflector.xml

* Update reflectionzendextension.xml

* Update reflectionuniontype.xml

* Update reflectiontype.xml

* Update reflectionreference.xml

* Update reflectionproperty.xml

* Update reflectionparameter.xml

* Update reflectionobject.xml

* Update reflectionnamedtype.xml

* Update reflectionmethod.xml

* Update reflectionfunction.xml

* Update reflectiongenerator.xml

* Update reflectionexception.xml

* Update export.xml
2023-02-16 22:59:01 +08:00

162 lines
3.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: ec2fe9a592f794978114ef5021db9f1d00c2e05d Maintainer: 谢毅斌 Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="reflectionmethod.invokeargs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionMethod::invokeArgs</refname>
<refpurpose>带参数执行</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionMethod">
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionMethod::invokeArgs</methodname>
<methodparam><type class="union"><type>object</type><type>null</type></type><parameter>object</parameter></methodparam>
<methodparam><type>array</type><parameter>args</parameter></methodparam>
</methodsynopsis>
<para>
使用数组给方法传送参数,并执行他。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
调用方法的对象,如果是静态对象,设置为 <type>null</type>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
使用 <type>array</type> 传送的方法参数。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
返回方法返回值。
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
如果 <parameter>object</parameter> 指定的实例无法执行方法,那么产生
<classname>ReflectionException</classname> 异常。
</para>
<para>
如果方法调用失败,产生 <classname>ReflectionException</classname>
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
<parameter>args</parameter> 的键现在将解释为参数的名称,而不是默默忽略。
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><methodname>ReflectionMethod::invokeArgs</methodname> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
class HelloWorld {
public function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
echo $reflectionMethod->invokeArgs(new HelloWorld(), array('Mike'));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Hello Mike
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
&reflection.invoke.reference;
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>ReflectionMethod::invoke</methodname></member>
<member><link linkend="object.invoke">__invoke()</link></member>
<member><function>call_user_func_array</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->