svn: /phpdoc/ja/trunk/reference/spl/functions/ class-uses.xml spl-autoload-register.xml
| From: | TAKAGI Masahiro | Date: | Tue, 22 May 2012 23:12:33 +0000 |
| Subject: | svn: /phpdoc/ja/trunk/reference/spl/functions/ class-uses.xml spl-autoload-register.xml | ||
| Groups: | php.doc.ja | ||
| Request: | Send a blank email to doc-ja+get-3406@lists.php.net to get a copy of this message | ||
takagi Tue, 22 May 2012 23:12:33 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=325784
Log:
sync with en.
Changed paths:
U phpdoc/ja/trunk/reference/spl/functions/class-uses.xml
U phpdoc/ja/trunk/reference/spl/functions/spl-autoload-register.xml
Modified: phpdoc/ja/trunk/reference/spl/functions/class-uses.xml
===================================================================
--- phpdoc/ja/trunk/reference/spl/functions/class-uses.xml 2012-05-22 20:52:05 UTC (rev 325783)
+++ phpdoc/ja/trunk/reference/spl/functions/class-uses.xml 2012-05-22 23:12:33 UTC (rev 325784)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 322134 Maintainer: takagi Status: ready -->
+<!-- EN-Revision: 325772 Maintainer: takagi Status: ready -->
<refentry xml:id="function.class-uses" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>class_uses</refname>
@@ -73,13 +73,13 @@
print_r(class_uses('bar'));
-
function __autoload($class_name) {
require_once $class_name . '.php';
}
// __autoload で 'not_loaded' クラスを読み込みます
-print_r(class_implements('not_loaded', true));
+print_r(class_uses('not_loaded', true));
+
?>
]]>
</programlisting>
Modified: phpdoc/ja/trunk/reference/spl/functions/spl-autoload-register.xml
===================================================================
--- phpdoc/ja/trunk/reference/spl/functions/spl-autoload-register.xml 2012-05-22 20:52:05 UTC (rev
325783)
+++ phpdoc/ja/trunk/reference/spl/functions/spl-autoload-register.xml 2012-05-22 23:12:33 UTC (rev
325784)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 325343 Maintainer: takagi Status: ready -->
+<!-- EN-Revision: 325783 Maintainer: takagi Status: ready -->
<!-- CREDITS: shimooka -->
<refentry xml:id="function.spl-autoload-register" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
@@ -113,11 +113,36 @@
&reftitle.examples;
<para>
<example>
- <title><function>spl_autoload_register</function> の例</title>
+ <title><function>spl_autoload_register</function> を
<function>__autoload</function> 関数の代わりに使う例</title>
<programlisting role="php">
<![CDATA[
<?php
+// function __autoload($class) {
+// include 'classes/' . $class . '.class.php';
+// }
+
+function my_autoloader($class) {
+ include 'classes/' . $class . '.class.php';
+}
+
+spl_autoload_register('my_autoloader');
+
+// あるいは、PHP 5.3.0 以降なら無名関数を使えます
+spl_autoload_register(function ($class) {
+ include 'classes/' . $class . '.class.php';
+});
+
+?>
+]]>
+ </programlisting>
+ </example>
+ <example>
+ <title><function>spl_autoload_register</function>
でクラスをロードしない例</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
namespace Foobar;
class Foo {