⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.require.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>require</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="function.return.html">return</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.include.html">include</a></div> <div class="up"><a href="language.control-structures.html">Control Structures</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.require" class="sect1">   <h2 class="title"><b>require()</b></h2>   <p class="simpara">    The <b>require()</b> statement includes and evaluates    the specific file.   </p>   <p class="simpara">     <b>require()</b> includes and evaluates a specific file.     Detailed information on how this inclusion works is described in the     documentation for <b>include()</b>.   </p>   <p class="simpara">     <b>require()</b> and <b>include()</b>     are identical in every way except how they handle failure. They both     produce a <a href="errorfunc.constants.html#errorfunc.constants.errorlevels.e-warning" class="link">Warning</a>, but     <b>require()</b> results in a <a href="errorfunc.constants.html#errorfunc.constants.errorlevels.e-error" class="link">     Fatal Error</a>.  In other words, don&#039;t hesitate to use     <b>require()</b> if you want a missing file to halt processing     of the page.  <b>include()</b> does not behave this way, the     script will continue regardless.  Be sure to have an appropriate     <a href="ini.core.html#ini.include-path" class="link">include_path</a> setting as well.   </p>   <p class="para">    <div class="example">     <p><b>Example #1 Basic <b>require()</b> examples</b></p>     <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">require&nbsp;</span><span style="color: #DD0000">'prepend.php'</span><span style="color: #007700">;<br /><br />require&nbsp;</span><span style="color: #0000BB">$somefile</span><span style="color: #007700">;<br /><br />require&nbsp;(</span><span style="color: #DD0000">'somefile.txt'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>     </div>   </div>   </p>   <p class="simpara">    See the <b>include()</b> documentation for more examples.   </p>   <p class="para">    <blockquote><p><b class="note">Note</b>:      <span class="simpara">      Prior to PHP 4.0.2, the following applies: <b>require()</b>      will always attempt to read the target file, even if the line it&#039;s on      never executes.  The conditional statement won&#039;t affect      <b>require()</b>. However, if the line on which the      <b>require()</b> occurs is not executed, neither will any of      the code in the target file be executed.  Similarly, looping structures      do not affect the behaviour of <b>require()</b>. Although      the code contained in the target file is still subject to the loop, the      <b>require()</b> itself happens only once.     </span>    </p></blockquote>   </p>   <blockquote><p><b class="note">Note</b>: <span class="simpara">Because this is a language construct and not a function, it cannot be called using <a href="functions.variable-functions.html" class="link">variable functions</a></span></p></blockquote>   <div class="warning"><b class="warning">Warning</b><p class="para">Windows versions of PHPprior to PHP 4.3.0 do not support access of remote files via this function,even if <a href="filesystem.configuration.html#ini.allow-url-fopen" class="link">allow_url_fopen</a> is enabled.</p></div>   <p class="simpara">    See also <b>include()</b>, <b>require_once()</b>,    <b>include_once()</b>, <a href="function.get-included-files.html" class="function">get_included_files()</a>,    <a href="function.eval.html" class="function">eval()</a>, <a href="function.file.html" class="function">file()</a>, <a href="function.readfile.html" class="function">readfile()</a>,    <a href="function.virtual.html" class="function">virtual()</a> and <a href="ini.core.html#ini.include-path" class="link">include_path</a>.   </p>  </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.return.html">return</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.include.html">include</a></div> <div class="up"><a href="language.control-structures.html">Control Structures</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 + -