<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.network.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.openlog.php',
    1 => 'openlog',
    2 => 'Open connection to system logger',
  ),
  'up' => 
  array (
    0 => 'ref.network.php',
    1 => '网络 函数',
  ),
  'prev' => 
  array (
    0 => 'function.net-get-interfaces.php',
    1 => 'net_get_interfaces',
  ),
  'next' => 
  array (
    0 => 'function.pfsockopen.php',
    1 => 'pfsockopen',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/network/functions/openlog.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openlog" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openlog</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openlog</span> &mdash; <span class="dc-title">Open connection to system logger</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openlog-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openlog</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$prefix</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$facility</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>openlog()</strong></span> opens a connection to the system
   logger for a program.  
  </p>
  <p class="para"> 
   The use of <span class="function"><strong>openlog()</strong></span> is optional. It
   will automatically be called by <span class="function"><a href="function.syslog.php" class="function">syslog()</a></span> if
   necessary, in which case <code class="parameter">prefix</code> will default
   to the empty string.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openlog-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">prefix</code></dt>
     <dd>
      <p class="para">
       The string <code class="parameter">prefix</code> is added to each message. 
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       Bitmask of the following constants:
       <ul class="simplelist">
        <li><strong><code><a href="network.constants.php#constant.log-cons">LOG_CONS</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-ndelay">LOG_NDELAY</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-odelay">LOG_ODELAY</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-nowait">LOG_NOWAIT</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-perror">LOG_PERROR</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-pid">LOG_PID</a></code></strong></li>
       </ul>
      </p>
     </dd>
    
    
     <dt><code class="parameter">facility</code></dt>
     <dd>
      <p class="para">
       The <code class="parameter">facility</code> argument is used to specify
       what type of program is logging the message.
       This lets the configuration file specify that messages from different
       facilities will be handled differently.
       Must be one of the following constants:
       <ul class="simplelist">
        <li><strong><code><a href="network.constants.php#constant.log-auth">LOG_AUTH</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-authpriv">LOG_AUTHPRIV</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-cron">LOG_CRON</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-daemon">LOG_DAEMON</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-kern">LOG_KERN</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-local0">LOG_LOCAL<span class="replaceable">[0-7]</span></a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-lpr">LOG_LPR</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-mail">LOG_MAIL</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-news">LOG_NEWS</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-syslog">LOG_SYSLOG</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-user">LOG_USER</a></code></strong></li>
        <li><strong><code><a href="network.constants.php#constant.log-uucp">LOG_UUCP</a></code></strong></li>
       </ul>
      </p>
      <blockquote class="note"><p><strong class="note">注意</strong>: 
       <span class="simpara">
        This parameter is ignored on Windows.
       </span>
      </p></blockquote>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openlog-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   总是返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>。
  </p>
 </div>


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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.2.0</td>
      <td>
       The function now always returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>. Previously it returned <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.openlog-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.syslog.php" class="function" rel="rdfs-seeAlso">syslog()</a> - Generate a system log message</span></li>
    <li><span class="function"><a href="function.closelog.php" class="function" rel="rdfs-seeAlso">closelog()</a> - 关闭系统日志链接</span></li>
   </ul>
  </p>
 </div>


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