<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.database.vendors.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'book.dbase.php',
    1 => 'dBase',
    2 => 'dBase',
  ),
  'up' => 
  array (
    0 => 'refs.database.vendors.php',
    1 => '针对各数据库系统对应的扩展',
  ),
  'prev' => 
  array (
    0 => 'function.cubrid-send-glo.php',
    1 => 'cubrid_send_glo',
  ),
  'next' => 
  array (
    0 => 'dbase.setup.php',
    1 => '安装/配置',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/dbase/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.dbase.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.dbase" class="book">
 
 <h1 class="title">dBase</h1>
 
 
 <div id="intro.dbase" class="preface">
  <h1 class="title">简介</h1>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    此扩展已被移至 <a href="https://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a> 资源库；不再与 PHP 捆绑，从 PHP 5.3.0.
   </p>
  </p></blockquote>
  <p class="para">
   These functions allow you to access records stored in dBase-format
   (dbf) databases.
  </p>
  <div class="warning"><strong class="warning">警告</strong>
   <p class="para">
    We recommend against using dBase files as your production
    database. Use <a href="http://sqlite.org/" class="link external">&raquo;&nbsp;SQLite</a> or choose any real SQL server instead; <a href="http://www.mysql.com/" class="link external">&raquo;&nbsp;MySQL</a> or <a href="http://www.postgresql.org/" class="link external">&raquo;&nbsp;Postgres</a>
    are common choices with PHP. dBase support is here to allow you to
    import and export data to and from your web database, because the
    file format is commonly understood by Windows spreadsheets and
    organizers.
   </p>
  </div>
  <div class="caution"><strong class="caution">警告</strong>
   <p class="para">
    As of dbase 7.0.0 the databases are automatically locked via
    <span class="function"><a href="function.flock.php" class="function">flock()</a></span>. There has been no support for locking earlier,
    so two concurrent web server processes modifying the same dBase file would
    have very likely ruined your database. This can happen even with dbase
    7.0.0+ on systems which implement the locks at the process level with
    multithreaded SAPIs.
   </p>
  </div>
  <p class="para">
   dBase files are simple sequential files of fixed length records. 
   Records are appended to the end of the file and deleted records are
   kept until you call <span class="function"><a href="function.dbase-pack.php" class="function">dbase_pack()</a></span>.
  </p>
  <p class="para">
   Only dbf file levels 3 (dBASE III+) - 5 (dBASE V) are supported.
   The types of dBase fields available are:
   <table class="doctable table">
    <caption><strong>Available types of fields</strong></caption>
    
     <thead>
      <tr>
       <th>Field</th>
       <th>dBase Type</th>
       <th>Format</th>
       <th>Additional information</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><code class="literal">M</code></td>
       <td>Memo</td>
       <td>n/a</td>
       <td>This type is not supported by PHP, such field will be ignored</td>
      </tr>

      <tr>
       <td><code class="literal">D</code></td>
       <td>Date</td>
       <td><code class="literal">YYYYMMDD</code></td>
       <td>The field length is limited to 8</td>
      </tr>

      <tr>
       <td><code class="literal">T</code></td>
       <td>DateTime</td>
       <td><code class="literal">YYYYMMDDhhmmss.uuu</code></td>
       <td>(FoxPro) No validity checks are done. Available as of dbase 7.0.0.</td>
      </tr>

      <tr>
       <td><code class="literal">N</code></td>
       <td>Number</td>
       <td>A number</td>
       <td>
        You must declare a length and a precision (the number of digits
        after the decimal point).
       </td>
      </tr>

      <tr>
       <td><code class="literal">F</code></td>
       <td>Float</td>
       <td>A float number</td>
       <td>Same as <code class="literal">N</code>.</td>
      </tr>

      <tr>
       <td><code class="literal">C</code></td>
       <td>String</td>
       <td>A string</td>
       <td>You must declare a length. When retrieving data, the string
       will be right-padded with spaces to fit the declared length. Overlong
       strings will be silently truncated when storing data.</td>
      </tr>

      <tr>
       <td><code class="literal">L</code></td>
       <td>Boolean</td>
       <td>
        <code class="literal">T</code> or <code class="literal">Y</code> for <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, 
        <code class="literal">F</code> or <code class="literal">N</code> for <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>,
        <code class="literal">?</code> for uninitialized.
       </td>
       <td>
        As of dbase 7.0.0, returned as a <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> (<strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>),
        or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> for uninitialized fields.
        Formerly, returned as an <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> (<code class="literal">1</code> or <code class="literal">0</code>).
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    As of dbase 7.0.0 nullable fields are supported for
    <strong><code><a href="dbase.constants.php#constant.dbase-type-foxpro">DBASE_TYPE_FOXPRO</a></code></strong> databases. If a field is nullable,
    passing <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> will set the respective flag, and on later retrieval the field
    value will be <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    There is no support for indexes or memo fields.
   </p>
  </p></blockquote>
 </div>
 
 
 







 







 


 




<ul class="chunklist chunklist_book"><li><a href="dbase.setup.php">安装/配置</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="dbase.installation.php">安装</a></li><li><a href="dbase.resources.php">资源类型</a></li></ul></li><li><a href="dbase.constants.php">预定义常量</a></li><li><a href="ref.dbase.php">dBase 函数</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.dbase-add-record.php">dbase_add_record</a> — Adds a record to a database</li><li><a href="function.dbase-close.php">dbase_close</a> — Closes a database</li><li><a href="function.dbase-create.php">dbase_create</a> — Creates a database</li><li><a href="function.dbase-delete-record.php">dbase_delete_record</a> — Deletes a record from a database</li><li><a href="function.dbase-get-header-info.php">dbase_get_header_info</a> — Gets the header info of a database</li><li><a href="function.dbase-get-record.php">dbase_get_record</a> — Gets a record from a database as an indexed array</li><li><a href="function.dbase-get-record-with-names.php">dbase_get_record_with_names</a> — Gets a record from a database as an associative array</li><li><a href="function.dbase-numfields.php">dbase_numfields</a> — Gets the number of fields of a database</li><li><a href="function.dbase-numrecords.php">dbase_numrecords</a> — Gets the number of records in a database</li><li><a href="function.dbase-open.php">dbase_open</a> — Opens a database</li><li><a href="function.dbase-pack.php">dbase_pack</a> — Packs a database</li><li><a href="function.dbase-replace-record.php">dbase_replace_record</a> — Replaces a record in a database</li></ul></li></ul></div><?php manual_footer($setup); ?>