<?php namespace h\i\j; function add2($a, $b) { echo "call add2 !", "\n"; return $a + $b; } //调用两次 add2(4, 5); \h\i\j\add2(1, 2); // 注意当前的namespace,下面是个错误示范 // h\i\j\add2(2,3);
<?php namespace my; include 'bein1.php'; include 'bein2.php'; use h\i\j as myj; echo 'I Am Index', "\n"; echo $a, "\n"; echo \h\i\j\add2(6, 7), " //this is 6+7", "\n"; function var_dump($a) { echo '\\var_dump has be killed'; } echo myj\add2(8, 1);