<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.dbase.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.dbase-open.php',
    1 => 'dbase_open',
    2 => 'Opens a database',
  ),
  'up' => 
  array (
    0 => 'ref.dbase.php',
    1 => 'dBase 函数',
  ),
  'prev' => 
  array (
    0 => 'function.dbase-numrecords.php',
    1 => 'dbase_numrecords',
  ),
  'next' => 
  array (
    0 => 'function.dbase-pack.php',
    1 => 'dbase_pack',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/dbase/functions/dbase-open.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.dbase-open" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">dbase_open</h1>
  <p class="verinfo">(PHP 5 &lt; 5.3.0, dbase 5, dbase 7)</p><p class="refpurpose"><span class="refname">dbase_open</span> &mdash; <span class="dc-title">Opens a database</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.dbase-open-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>dbase_open</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code></span>): <span class="type"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>dbase_open()</strong></span> opens a dBase database with the given
   access mode.
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: <p class="para">此函数受
<a href="ini.core.php#ini.open-basedir" class="link">open_basedir</a> 影响。</p></p></blockquote>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.dbase-open-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       The path of the database. It can be a relative or absolute path to
       the file where dBase will store your data.
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       An integer which correspond to those for the <strong class="command">open()</strong> 
       system call (Typically 0 means read-only, 1 means write-only, and 2 
       means read and write).
      </p>
      <blockquote class="note"><p><strong class="note">注意</strong>: 
       <p class="para">
        You can&#039;t open a dBase file in write-only mode as the function will
        fail to read the headers information and thus you can&#039;t use 1 as
        <code class="parameter">mode</code>.
       </p>
      </p></blockquote>
      <p class="para">
       As of dbase 7.0.0 you can use <strong><code><a href="dbase.constants.php#constant.dbase-rdonly">DBASE_RDONLY</a></code></strong>
       and <strong><code><a href="dbase.constants.php#constant.dbase-rdwr">DBASE_RDWR</a></code></strong>, respectively, to specify the
       <code class="parameter">mode</code>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.dbase-open-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a database resource on success,  或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.dbase-open-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL dbase 7.0.0</td>
      <td>
       The return value is now a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> instead of an
       <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.dbase-open-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 Opening a dBase database file</strong></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: #FF8000">// open in read-only mode<br /></span><span style="color: #0000BB">$db </span><span style="color: #007700">= </span><span style="color: #0000BB">dbase_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'/tmp/test.dbf'</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">$db</span><span style="color: #007700">) {<br />  </span><span style="color: #FF8000">// read some data ..<br />  <br />  </span><span style="color: #0000BB">dbase_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$db</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.dbase-open-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.dbase-create.php" class="function" rel="rdfs-seeAlso">dbase_create()</a> - Creates a database</span></li>
    <li><span class="function"><a href="function.dbase-close.php" class="function" rel="rdfs-seeAlso">dbase_close()</a> - Closes a database</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>