Blogger Information
Blog 60
fans 0
comment 1
visits 37745
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
USE导入空间/别名-0508
威灵仙的博客
Original
664 people have browsed it
  1. php


    实例

    <?php     //1.php
    class Person{
        function __construct(){
                echo 'I am one!<br/>';
            }}

    运行实例 »

    点击 "运行实例" 按钮查看在线实例


  2. 实例

    <?php
       namespace School\Parents;
        class Man{
            function __construct(){
                echo 'Listen to teachers!<br/>';
            }
        }
        namespace School\Teacher;
        class Person{
            function __construct(){
                echo 'Please study!<br/>';
            }
        }
        namespace School\Student;
        require_once './1.php';
        require_once './2.php';
        class Person{
            function __construct(){
                echo 'I want to play!<br/>';
            }
        }
        new Person();                   //输出I want to play!
        new \School\Teacher\Person();   //输出Please study!
        //new Teacher\Person();           //报错
       // ----------
        use School\Teacher;
        new Teacher\Person();           //输出Please study!
      //  ----------
        use School\Teacher as Tc;
        new Tc\Person();           //输出Please study!
       // ----------
        //use \School\Teacher\Person;
        new \Person();           //报错
       // ----------
        // use \School\Parent\Man;
        // new Man();           //报错

    运行实例 »

    点击 "运行实例" 按钮查看在线实例

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post