📄 language.namespaces.global.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Global space</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.namespaces.using.html">Using namespaces</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.namespaces.constant.html">__NAMESPACE__</a></div> <div class="up"><a href="language.namespaces.html">Namespaces</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="language.namespaces.global" class="sect1"> <h2 class="title">Global space</h2> <p class="para"> Without any namespace definition, all class and function definitions are placed into the global space - as it was in PHP before namespaces were supported. Prefixing a name with <i>::</i> will specify that the name is required from the global space even in the context of the namespace. <div class="example"> <p><b>Example #1 Using global space specification</b></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /> namespace A</span><span style="color: #007700">::</span><span style="color: #0000BB">B</span><span style="color: #007700">::</span><span style="color: #0000BB">C</span><span style="color: #007700">;<br /> <br /> </span><span style="color: #FF8000">/* This function is A::B::C::fopen */<br /> </span><span style="color: #007700">function </span><span style="color: #0000BB">fopen</span><span style="color: #007700">() { <br /> </span><span style="color: #FF8000">/* ... */<br /> </span><span style="color: #0000BB">$f </span><span style="color: #007700">= ::</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(...); </span><span style="color: #FF8000">// call global fopen<br /> </span><span style="color: #007700">return </span><span style="color: #0000BB">$f</span><span style="color: #007700">;<br /> } <br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.namespaces.using.html">Using namespaces</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.namespaces.constant.html">__NAMESPACE__</a></div> <div class="up"><a href="language.namespaces.html">Namespaces</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -