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

📄 internals2.structure.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>Extension structure</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="internals2.buildsys.configwin.html">Talking to the Windows build system: config.w32</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.structure.basics.html">Basic constructs</a></div> <div class="up"><a href="internals2.html">PHP at the Core: A Hacker's Guide to the Zend Engine</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div>  <h1>Extension structure</h1><h2>Table of Contents</h2><ul class="chunklist chunklist_chapter"><li><a href="internals2.structure.basics.html">Basic constructs</a></li><li><a href="internals2.structure.modstruct.html">The zend_module structure</a></li><li><a href="internals2.structure.globals.html">Extension globals</a></li><li><a href="internals2.structure.lifecycle.html">Life cycle of an extension</a></li><li><a href="internals2.structure.tests.html">Testing an extension</a></li></ul>  <p class="para">   Many extension-writing guides focus on simple examples first and ignore the   requirements of more complex implementations until later. Often such guides   must repeat themselves over and over in order to describe these new   features. This section describes extension structure from the perspective of   a mature, practical implementation, in order to prepare users for needs and   issues they will almost always encounter in the process of extension   development.  </p>     <div id="internals2.structure.files" class="sect1">  <h2 class="title">Files which make up an extension</h2>  <p class="para">   Whether created by hand, using <strong class="command">ext_skel</strong>, or by an   alternate extension generator, such as   <a href="http://codegenerators.php-baustelle.de/" class="link external">&raquo; CodeGen</a>,   all extensions will have at least four files:  </p>  <dl>   <dt>    <span class="term"><var class="filename">config.m4</var></span>    <dd>     <p class="para">      UNIX build system configuration (see      <a href="internals2.buildsys.configunix.html" class="xref">Talking to the UNIX build system: config.m4</a>)     </p>    </dd>   </dt>   <dt>    <span class="term"><var class="filename">config.w32</var></span>    <dd>     <p class="para">      Windows buildsystem configuration (see      <a href="internals2.buildsys.configwin.html" class="xref">Talking to the Windows build system: config.w32</a>)     </p>    </dd>   </dt>      <dt>    <span class="term"><var class="filename">php_counter.h</var></span>    <dd>     <p class="para">      When building an extension as static module into the PHP binary the      build system expects a header file with <i>php_</i>      prepended to the extension name which includes a declaration for a      pointer to the extension&#039;s module structure. This file usually contains      additional macros, prototypes, and globals, just like any header.     </p>    </dd>   </dt>      <dt>    <span class="term"><var class="filename">counter.c</var></span>    <dd>     <p class="para">      Main extension source file. By convention, the name of this file      is the extension name, but this is not a requirement. This file      contains the module structure declaration, INI entries, management      functions, userspace functions, and other requirements of an extension.     </p>    </dd>   </dt>  </dl>    <p class="para">   The buildsystem files are discussed elsewhere; this section concentrates on   the rest. These four files make up the bare minimum for an extension, which   may also contain any number of headers, source files, unit tests, and other   support files. The list of files in the counter extension might look like   this:  </p>    <div class="example" id="internals2.structure.files.ex1" name="internals2.structure.files.ex1">   <p><b>Example #1 Files in the counter extension, in no particular order</b></p>   <div class="example-contents"><pre><div class="cdata"><pre>ext/ counter/  .cvsignore  config.m4  config.w32  counter_util.h  counter_util.c  php_counter.h  counter.c  package.xml  CREDITS  tests/   critical_function_001.phpt   critical_function_002.phpt   optional_function_001.phpt   optional_function_002.phpt</pre></div>   </pre></div>  </div>     <div id="internals2.structure.files.misc-files" class="sect2">   <h3 class="title">Non-source files</h3>   <p class="para">    The <var class="filename">.cvsignore</var> file is used for extensions which are    checked into one of the PHP <strong class="command">CVS</strong> repositories (usually    <a href="http://pecl.php.net/" class="link external">&raquo; PECL</a>); the one generated by <strong class="command">ext_skel</strong> contains:   </p>     <div class="informalexample">    <div class="example-contents"><div class="cdata"><pre>.deps*.lo*.la</pre></div>    </div>   </div>     <p class="para">    These lines tell <strong class="command">CVS</strong> to ignore interim files generated    by the PHP buildsystem. This is only a convenience, and can be omitted    completely without ill effect.   </p>      <p class="para">    The <var class="filename">CREDITS</var> file lists the contributors and/or    maintainers of the extension in plain text format. The main purpose of     this file is generating the credits information for bundled extensions as    used by <a href="function.phpcredits.html" class="function">phpcredits()</a>. By convention the first line of    the file should hold the name of the extension, the second a comma     separated list of contributors. The contributors are usually ordered by the    chronological order of their contributions. In a <a href="http://pecl.php.net/" class="link external">&raquo; PECL</a> package,    this information is already maintained in <var class="filename">package.xml</var>,    for example. This is another file which can be omitted without ill effect.   </p>      <p class="para">    The <var class="filename">package.xml</var> file is specific to <a href="http://pecl.php.net/" class="link external">&raquo; PECL</a>-based    extensions; it is a metainformation file which gives details about an    extension&#039;s dependencies, authors, installation requirements, and other    tidbits. In an extension not being hosted in <a href="http://pecl.php.net/" class="link external">&raquo; PECL</a>, this file is    extraneous.   </p>  </div>   </div>                  </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="internals2.buildsys.configwin.html">Talking to the Windows build system: config.w32</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.structure.basics.html">Basic constructs</a></div> <div class="up"><a href="internals2.html">PHP at the Core: A Hacker's Guide to the Zend Engine</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 + -