Correction status:qualified
Teacher's comments:
php
<?php //1.php class Person{ function __construct(){ echo 'I am one!<br/>'; }}
点击 "运行实例" 按钮查看在线实例
<?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(); //报错
点击 "运行实例" 按钮查看在线实例