Home  >  Article  >  Backend Development  >  php global space

php global space

伊谢尔伦
伊谢尔伦Original
2016-11-23 10:50:31891browse

If no namespace is defined, all classes and functions are defined in the global space, just like before PHP introduced the namespace concept. Prefixing the name with means that the name is in the global space, even if the name is in another namespace.

Use global space instructions

<?php
    namespace A\B\C;
    /* 这个函数是 A\B\C\fopen */
    function fopen() {
        /* ... */
        $f = \fopen(...); // 调用全局的fopen函数
        return $f;
    }
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn