Function entry for __autoload

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@322137 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jakub Vrana 2012-01-12 15:04:13 +00:00
parent fcddfb2551
commit d6105d5f55
3 changed files with 85 additions and 5 deletions

View file

@ -2,10 +2,6 @@
<!-- $Revision$ -->
<sect1 xml:id="language.oop5.autoload" xmlns="http://docbook.org/ns/docbook">
<title>Autoloading Classes</title>
<methodsynopsis xml:id="function.autoload">
<type>void</type><methodname>__autoload</methodname>
<methodparam><type>string</type><parameter>class</parameter></methodparam>
</methodsynopsis>
<para>
Many developers writing object-oriented applications create
one PHP source file per-class definition. One of the biggest
@ -14,7 +10,7 @@
</para>
<para>
In PHP 5, this is no longer necessary. You may define an
__autoload function which is automatically
<function>__autoload</function> function which is automatically
called in case you are trying to use a class/interface which hasn't been
defined yet. By calling this function the scripting engine is given
a last chance to load the class before PHP fails with an error.

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.autoload" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>__autoload</refname>
<refpurpose>Attempt to load undefined class</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>__autoload</methodname>
<methodparam><type>string</type><parameter>class</parameter></methodparam>
</methodsynopsis>
<para>
You can define this function to enable <link
linkend="language.oop5.autoload">classes autoloading</link>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>class</parameter></term>
<listitem>
<para>
Name of the class to load
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>spl_autoload_register</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
-->

View file

@ -140,6 +140,16 @@ Fatal error: Class 'Foobar\InexistentClass' not found in ...
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>__autoload</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file