<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >POSIX Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="函数参考" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="zend_version" HREF="function.zend-version.html"><LINK REL="NEXT" TITLE="posix_access" HREF="function.posix-access.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" 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.zend-version.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.posix-access.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.posix" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CXXV. POSIX Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN182691" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="posix.intro" >简介</A ></H1 ><P > This module contains an interface to those functions defined in the IEEE 1003.1 (POSIX.1) standards document which are not accessible through other means. POSIX.1 for example defined the open(), read(), write() and close() functions, too, which traditionally have been part of PHP 3 for a long time. Some more system specific functions have not been available before, though, and this module tries to remedy this by providing easy access to these functions. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >警告</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > Sensitive data can be retrieved with the POSIX functions, e.g. <A HREF="function.posix-getpwnam.html" ><B CLASS="function" >posix_getpwnam()</B ></A > and friends. None of the POSIX function perform any kind of access checking when <A HREF="features.safe-mode.html#ini.safe-mode" >safe mode</A > is enabled. It's therefore <SPAN CLASS="strong" ><B CLASS="emphasis" >strongly</B ></SPAN > advised to disable the POSIX extension at all (use <TT CLASS="literal" >--disable-posix</TT > in your configure line) if you're operating in such an environment. </P ></TD ></TR ></TABLE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B >本扩展模块在 Windows 平台下不可用。</P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="posix.installation" >安装</A ></H1 ><P > POSIX functions are enabled by default. You can disable POSIX-like functions with <CODE CLASS="option" >--disable-posix</CODE >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="posix.constants" >预定义常量</A ></H1 ><P >以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。</P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >POSIX_F_OK</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Check whether the file exists. </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_R_OK</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Check whether the file exists and has read permissions. </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_W_OK</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Check whether the file exists and has write permissions. </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_X_OK</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Check whether the file exists and has execute permissions. </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_S_IFBLK</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Block special file </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_S_IFCHR</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Character special file </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_S_IFIFO</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > FIFO (named pipe) special file </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_S_IFREG</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Normal file </P ></DD ><DT ><TT CLASS="constant" ><B >POSIX_S_IFSOCK</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Socket </P ></DD ></DL ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > These constants are available since PHP 5.1.0. Please also note that some of them may not be available in your system. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="posix.seealso" >参见</A ></H1 ><P > The section about <A HREF="ref.pcntl.html" >Process Control Functions</A > maybe of interest for you. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >目录</B ></DT ><DT ><A HREF="function.posix-access.html" >posix_access</A > -- Determine accessibility of a file </DT ><DT ><A HREF="function.posix-ctermid.html" >posix_ctermid</A > -- Get path name of controlling terminal</DT ><DT ><A HREF="function.posix-get-last-error.html" >posix_get_last_error</A > -- Retrieve the error number set by the last posix function that failed</DT ><DT ><A HREF="function.posix-getcwd.html" >posix_getcwd</A > -- Pathname of current directory</DT ><DT ><A HREF="function.posix-getegid.html" >posix_getegid</A > -- Return the effective group ID of the current process</DT ><DT ><A HREF="function.posix-geteuid.html" >posix_geteuid</A > -- Return the effective user ID of the current process</DT ><DT ><A HREF="function.posix-getgid.html" >posix_getgid</A > -- Return the real group ID of the current process</DT ><DT ><A HREF="function.posix-getgrgid.html" >posix_getgrgid</A > -- Return info about a group by group id</DT ><DT ><A HREF="function.posix-getgrnam.html" >posix_getgrnam</A > -- Return info about a group by name</DT ><DT ><A HREF="function.posix-getgroups.html" >posix_getgroups</A > -- Return the group set of the current process</DT ><DT ><A HREF="function.posix-getlogin.html" >posix_getlogin</A > -- Return login name</DT ><DT ><A HREF="function.posix-getpgid.html" >posix_getpgid</A > -- Get process group id for job control</DT ><DT ><A HREF="function.posix-getpgrp.html" >posix_getpgrp</A > -- Return the current process group identifier</DT ><DT ><A HREF="function.posix-getpid.html" >posix_getpid</A > -- Return the current process identifier</DT ><DT ><A HREF="function.posix-getppid.html" >posix_getppid</A > -- Return the parent process identifier</DT ><DT ><A HREF="function.posix-getpwnam.html" >posix_getpwnam</A > -- Return info about a user by username</DT ><DT ><A HREF="function.posix-getpwuid.html" >posix_getpwuid</A > -- Return info about a user by user id</DT ><DT ><A HREF="function.posix-getrlimit.html" >posix_getrlimit</A > -- Return info about system resource limits</DT ><DT ><A HREF="function.posix-getsid.html" >posix_getsid</A > -- Get the current sid of the process</DT ><DT ><A HREF="function.posix-getuid.html" >posix_getuid</A > -- Return the real user ID of the current process</DT ><DT ><A HREF="function.posix-isatty.html" >posix_isatty</A > -- Determine if a file descriptor is an interactive terminal</DT ><DT ><A HREF="function.posix-kill.html" >posix_kill</A > -- Send a signal to a process</DT ><DT ><A HREF="function.posix-mkfifo.html" >posix_mkfifo</A > -- Create a fifo special file (a named pipe)</DT ><DT ><A HREF="function.posix-mknod.html" >posix_mknod</A > -- Create a special or ordinary file (POSIX.1) </DT ><DT ><A HREF="function.posix-setegid.html" >posix_setegid</A > -- Set the effective GID of the current process</DT ><DT ><A HREF="function.posix-seteuid.html" >posix_seteuid</A > -- Set the effective UID of the current process</DT ><DT ><A HREF="function.posix-setgid.html" >posix_setgid</A > -- Set the GID of the current process</DT ><DT ><A HREF="function.posix-setpgid.html" >posix_setpgid</A > -- Set process group id for job control</DT ><DT ><A HREF="function.posix-setsid.html" >posix_setsid</A > -- Make the current process a session leader</DT ><DT ><A HREF="function.posix-setuid.html" >posix_setuid</A > -- Set the UID of the current process</DT ><DT ><A HREF="function.posix-strerror.html" >posix_strerror</A > -- Retrieve the system error message associated with the given errno</DT ><DT ><A HREF="function.posix-times.html" >posix_times</A > -- Get process times</DT ><DT ><A HREF="function.posix-ttyname.html" >posix_ttyname</A > -- Determine terminal device name</DT ><DT ><A HREF="function.posix-uname.html" >posix_uname</A > -- Get system name</DT ></DL ></DIV ></DIV ></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.zend-version.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.posix-access.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >zend_version</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >posix_access</TD ></TR ></TABLE ></DIV ></BODY ></HTML >