You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
505 B

3 years ago
  1. <?php
  2. namespace Foo\Bar\subnamespace;
  3. const FOO = 1;
  4. function foo() {
  5. echo '命名空间:'.__NAMESPACE__.'--函数:foo'.'<br>';
  6. }
  7. class foo
  8. {
  9. // public function demo() {
  10. //如果使用public,会报错Fatal error: Uncaught Error: Non-static method Foo\Bar\subnamespace\foo::demo() cannot be called statically in
  11. static function demo() {
  12. echo '命名空间为:'.__NAMESPACE__.'--类foo的方法demo'.'<br>';
  13. }
  14. }
  15. ?>