Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 9090

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>php_uname</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="PHP Options&Information"
HREF="ref.info.html"><LINK
REL="PREVIOUS"
TITLE="php_sapi_name"
HREF="function.php-sapi-name.html"><LINK
REL="NEXT"
TITLE="phpcredits"
HREF="function.phpcredits.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.php-sapi-name.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.phpcredits.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.php-uname"
></A
>php_uname</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN181953"
></A
><P
>    (PHP 4 &#62;= 4.0.2, PHP 5)</P
>php_uname&nbsp;--&nbsp;Returns information about the operating system PHP is running on</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN181956"
></A
><H2
>说明</H2
>string <B
CLASS="methodname"
>php_uname</B
> ( [string mode] )<BR
></BR
><P
>&#13;   <B
CLASS="function"
>php_uname()</B
> returns a description of the operating
   system PHP is running on. For the name of just the operating system,
   consider using the <TT
CLASS="constant"
><B
>PHP_OS</B
></TT
> constant, but be
   reminded this constant will contain the operating system PHP was
   <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>built</I
></SPAN
> on.
  </P
><P
>&#13;   On Unix, the output reverts to displaying the operating system
   information PHP was built on if it cannot determine the currently
   running OS.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN181969"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>mode</CODE
></DT
><DD
><P
>&#13;       <CODE
CLASS="parameter"
>mode</CODE
> is a single character that defines what
       information is returned:
       <P
></P
><UL
><LI
><P
>&#13;          <TT
CLASS="literal"
>'a'</TT
>: This is the default. Contains all modes in
          the sequence <TT
CLASS="literal"
>"s n r v m"</TT
>.
         </P
></LI
><LI
><P
>&#13;          <TT
CLASS="literal"
>'s'</TT
>: Operating system name. eg.
           <TT
CLASS="literal"
>FreeBSD</TT
>.
         </P
></LI
><LI
><P
>&#13;          <TT
CLASS="literal"
>'n'</TT
>: Host name. eg. 
          <TT
CLASS="literal"
>localhost.example.com</TT
>.
         </P
></LI
><LI
><P
>&#13;          <TT
CLASS="literal"
>'r'</TT
>: Release name. eg. 
          <TT
CLASS="literal"
>5.1.2-RELEASE</TT
>.
         </P
></LI
><LI
><P
>&#13;          <TT
CLASS="literal"
>'v'</TT
>: Version information. Varies a lot between
          operating systems.
         </P
></LI
><LI
><P
>&#13;          <TT
CLASS="literal"
>'m'</TT
>: Machine type. eg. <TT
CLASS="literal"
>i386</TT
>.
         </P
></LI
></UL
>
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN182003"
></A
><H2
>返回值</H2
><P
>&#13;   Returns the description, as a string.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN182006"
></A
><H2
>范例</H2
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN182009"
></A
><P
><B
>例 1. Some <B
CLASS="function"
>php_uname()</B
> examples</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br /></font><font color="#007700">echo </font><font color="#0000BB">php_uname</font><font color="#007700">();<br />echo </font><font color="#0000BB">PHP_OS</font><font color="#007700">;<br /><br /></font><font color="#FF8000">/* Some possible outputs:<br />Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686<br />Linux<br /><br />FreeBSD localhost 3.2-RELEASE #15: Mon Dec 17 08:46:02 GMT 2001<br />FreeBSD<br /><br />Windows NT XN1 5.1 build 2600<br />WINNT<br />*/<br /><br /></font><font color="#007700">if (</font><font color="#0000BB">strtoupper</font><font color="#007700">(</font><font color="#0000BB">substr</font><font color="#007700">(</font><font color="#0000BB">PHP_OS</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">3</font><font color="#007700">)) === </font><font color="#DD0000">'WIN'</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">'This is a server using Windows!'</font><font color="#007700">;<br />} else {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">'This is a server not using Windows!'</font><font color="#007700">;<br />}<br /><br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
><P
>&#13;   There are also some related <A
HREF="language.constants.predefined.html"
>&#13;   Predefined PHP constants</A
> that may come in handy, for example:
   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN182015"
></A
><P
><B
>例 2. A few OS related constant examples</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br /></font><font color="#FF8000">// *nix<br /></font><font color="#007700">echo </font><font color="#0000BB">DIRECTORY_SEPARATOR</font><font color="#007700">; </font><font color="#FF8000">// /<br /></font><font color="#007700">echo </font><font color="#0000BB">PHP_SHLIB_SUFFIX</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// so<br /></font><font color="#007700">echo </font><font color="#0000BB">PATH_SEPARATOR</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// :<br /><br />// Win*<br /></font><font color="#007700">echo </font><font color="#0000BB">DIRECTORY_SEPARATOR</font><font color="#007700">; </font><font color="#FF8000">// \<br /></font><font color="#007700">echo </font><font color="#0000BB">PHP_SHLIB_SUFFIX</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// dll<br /></font><font color="#007700">echo </font><font color="#0000BB">PATH_SEPARATOR</font><font color="#007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FF8000">// ;<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN182018"
></A
><H2
>参见</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.phpversion.html"
><B
CLASS="function"
>phpversion()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.php-sapi-name.html"
><B
CLASS="function"
>php_sapi_name()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.phpinfo.html"
><B
CLASS="function"
>phpinfo()</B
></A
></TD
></TR
></TBODY
></TABLE
><P
></P
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.php-sapi-name.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.phpcredits.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>php_sapi_name</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.info.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>phpcredits</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>