Home >Backend Development >PHP Tutorial >PHP之namespace renault espace espace auto espace.net patents

PHP之namespace renault espace espace auto espace.net patents

WBOY
WBOYOriginal
2016-07-29 08:53:161263browse

namespace (namespace) is equivalent to functions and classes, dividing an area so that the same class can be required on the same page and functions with the same name can be used
: Rarely used in projects

<code><span>//name.php</span><span><?php</span><span>//命名要使用复合名称</span><span>namespace</span><span>me</span>\<span>mine</span>;
<span><span>class</span><span>me</span>{</span><span>public</span><span><span>function</span><span>__construct</span><span>()</span>{</span><span>echo</span><span>'name'</span>.<span>'<br>'</span>;
    }
    <span>public</span><span><span>function</span><span>name</span><span>()</span>{</span><span>echo</span><span>'i use space'</span>.<span>'<br>'</span>;
    }
}
<span>//$me = new me();</span><span><span>function</span><span>me</span><span>()</span>{</span><span>echo</span><span>'is me'</span>.<span>'<br>'</span>;
}</code>
<code><span>//common.php</span><span><?php</span><span><span>class</span><span>me</span>{</span><span>public</span><span><span>function</span><span>__construct</span><span>()</span>{</span><span>echo</span><span>'no namespace'</span>.<span>'<br>'</span>;
    }
}</code>
<code><span><span><?php</span><span>//建议使用别名</span><span>use</span><span>me</span>\<span>mine</span><span>as</span><span>i</span>;
<span>require</span><span>'./name.php'</span>;
<span>require</span><span>'./common.php'</span>;

<span>$me</span> = <span>new</span> i\me();
<span>$me</span>->name();
i\me();

<span>$com</span> = <span>new</span> me();</span></span></code>

espace电脑版下载,华为espace电脑版下载,renault espace 2015,renault espace,espace auto,espace.net patents

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the namespace of PHP, including espace content. I hope it will be helpful to friends who are interested in PHP tutorials.

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