Correction status:qualified
Teacher's comments:
<?php /** * Created by PhpStorm. * User: 金超 * Date: 2018/5/9 * Time: 13:37 */ //创建第一个命名空间 namespace resource; class method { private $name=''; private $method=''; public function __construct($name='jack',$method='bus') { $this->name=$name; $this->method=$method; } public function goHome($name='jack',$method='bus') { return $this->name=$name.'今天通过'.$this->method=$method.'回家'; } } namespace resource\count; //创建第二个命名空间 //引用第一个命名空间中的类:method use resource\method; $num1=new method(); $num2=new method(); echo $num1->goHome(); echo'<hr style="color: blueviolet">'; echo$num2->goHome('Rose','ride on a bicycle');
点击 "运行实例" 按钮查看在线实例