file1
<?php namespace foo;
class Cat {
static function says() {
echo ‘meoow‘;}
}
function demo(){
echo __FILE__;
}
?>
file2
<?php namespace bar;
class Dog {
static function says()
{
echo ‘ruff‘;
}
}
function demo(){
echo __FILE__;
}
?>
file
<?php namespace fub;
include ‘demo1.php‘;
include ‘demo2.php‘;
use foo as feline;
use bar as canine;
echo feline\Cat::says();
echo canine\Dog::says();
echo feline\demo();
echo canine\demo();
?>
时间: 2024-10-27 01:42:46