language.types.resource.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 68 行

HTML
68
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Resources</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.types.object.html">Objects</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.types.null.html">NULL</a></div> <div class="up"><a href="language.types.html">Types</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="language.types.resource" class="sect1"> <h2 class="title">Resources</h2>   <p class="para">  A <a href="language.types.resource.html" class="type resource">resource</a> is a special variable, holding a reference to an  external resource. Resources are created and used by special functions. See  the <a href="resource.html" class="link">appendix</a> for a listing of all these  functions and the corresponding <a href="language.types.resource.html" class="type resource">resource</a> types. </p>   <blockquote><p><b class="note">Note</b>:   <span class="simpara">   The <a href="language.types.resource.html" class="type resource">resource</a> type was introduced in PHP 4  </span> </p></blockquote> <p class="para">  See also the <a href="function.get-resource-type.html" class="function">get_resource_type()</a> function. </p> <div id="language.types.resource.casting" class="sect2">  <h3 class="title">Converting to resource</h3>    <p class="para">   As <a href="language.types.resource.html" class="type resource">resource</a> variables hold special handlers to opened files,   database connections, image canvas areas and the like, converting to a   <a href="language.types.resource.html" class="type resource">resource</a> makes no sense.  </p> </div> <div id="language.types.resource.self-destruct" class="sect2">  <h3 class="title">Freeing resources</h3>    <p class="para">   Thanks to the reference-counting system introduced with PHP 4&#039;s Zend Engine,   a <a href="language.types.resource.html" class="type resource">resource</a> with no more references to it is detected   automatically, and it is freed by the garbage collector. For this reason, it   is rarely necessary to free the memory manually.  </p>  <blockquote><p><b class="note">Note</b>:    <span class="simpara">    Persistent database links are an exception to this rule. They are    <em class="emphasis">not</em> destroyed by the garbage collector. See the    <a href="features.persistent-connections.html" class="link">persistent    connections</a> section for more information.   </span>  </p></blockquote>   </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.types.object.html">Objects</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.types.null.html">NULL</a></div> <div class="up"><a href="language.types.html">Types</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?