-
Notifications
You must be signed in to change notification settings - Fork 102
/
resource.xml
63 lines (54 loc) · 1.93 KB
/
resource.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 95bdd6883b5dde9504701777ba81b3c5f15df52b Maintainer: Altair Status: ready -->
<!-- CREDITS: Geogory, dallas -->
<sect1 xml:id="language.types.resource">
<title>Resource 资源类型</title>
<para>
资源 <type>resource</type>
是一种特殊变量,保存了到外部资源的一个引用。资源是通过专门的函数来建立和使用的。所有这些函数及其相应资源类型见<link
linkend="resource">附录</link>。
</para>
<para>
参见 <function>get_resource_type</function>。
</para>
<sect2 xml:id="language.types.resource.casting">
<title>转换为资源</title>
<para>
由于资源类型变量保存有为打开文件、数据库连接、图形画布区域等的特殊句柄,因此将其它类型的值转换为资源没有意义。
</para>
</sect2>
<sect2 xml:id="language.types.resource.self-destruct">
<title>释放资源</title>
<para>
引用计数系统是 Zend 引擎的一部分,可以自动检测到一个资源不再被引用了(和
Java 一样)。这种情况下此资源使用的所有外部资源都会被垃圾回收系统释放。因此,很少需要手工释放内存。
</para>
<note>
<simpara>
持久数据库连接比较特殊,它们<emphasis>不会</emphasis>被垃圾回收系统销毁。参见<link
linkend="features.persistent-connections">数据库永久连接</link>一章。
</simpara>
</note>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->