php global space

伊谢尔伦
Release: 2016-11-23 10:50:31
Original
889 people have browsed it

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;
    }
?>
Copy after login


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!