cvs: phpdoc-zh /reference/filesystem ini.xml reference.xml /reference/filesystem/functions flock.xml fnmatch.xml fopen.xml fpassthru.xml fputs.xml
fread.xml fscanf.xml fseek.xml fstat.xml ftell.xml ftruncate.xml fwrite.xml glob.xml is-dir.xml is-executable.xml is-file.xml is-link.xml
is-readable.xml is-uploaded-file.xml is-writable.xml is-writeable.xml link.xml linkinfo.xml lstat.xml mkdir.xml move-uploaded-file.xml
parse-ini-file.xml pathinfo.xml pclose.xml popen.xml readfile.xml readlink.xml realpath.xml rename.xml rewind.xml rmdir.xml set-file-buffer.xml
stat.xml stream-set-blocking.xml stream-set-timeout.xml stream-set-write-buffer.xml symlink.xml tempnam.xml tmpfile.xml touch.xml umask.xml unlink.xml
| From: | Dallas Thunder | Date: | Mon, 30 Sep 2002 02:56:21 +0000 |
| Subject: | cvs: phpdoc-zh /reference/filesystem ini.xml reference.xml /reference/filesystem/functions flock.xml fnmatch.xml fopen.xml fpassthru.xml fputs.xml fread.xml fscanf.xml fseek.xml fstat.xml ftell.xml ftruncate.xml fwrite.xml glob.xml is-dir.xml is-executable.xml is-file.xml is-link.xml is-readable.xml is-uploaded-file.xml is-writable.xml is-writeable.xml link.xml linkinfo.xml lstat.xml mkdir.xml move-uploaded-file.xml parse-ini-file.xml pathinfo.xml pclose.xml popen.xml readfile.xml readlink.xml realpath.xml rename.xml rewind.xml rmdir.xml set-file-buffer.xml stat.xml stream-set-blocking.xml stream-set-timeout.xml stream-set-write-buffer.xml symlink.xml tempnam.xml tmpfile.xml touch.xml umask.xml unlink.xml |
||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-697@lists.php.net to get a copy of this message | ||
dallas Sun Sep 29 22:56:21 2002 EDT
Added files:
/phpdoc-zh/reference/filesystem ini.xml
/phpdoc-zh/reference/filesystem/functions flock.xml fnmatch.xml
fopen.xml fpassthru.xml
fputs.xml fread.xml
fscanf.xml fseek.xml
fstat.xml ftell.xml
ftruncate.xml fwrite.xml
glob.xml is-dir.xml
is-executable.xml
is-file.xml is-link.xml
is-readable.xml
is-uploaded-file.xml
is-writable.xml
is-writeable.xml link.xml
linkinfo.xml lstat.xml
mkdir.xml
move-uploaded-file.xml
parse-ini-file.xml
pathinfo.xml pclose.xml
popen.xml readfile.xml
readlink.xml realpath.xml
rename.xml rewind.xml
rmdir.xml
set-file-buffer.xml
stat.xml
stream-set-blocking.xml
stream-set-timeout.xml
stream-set-write-buffer.xml
symlink.xml tempnam.xml
tmpfile.xml touch.xml
umask.xml unlink.xml
Modified files:
/phpdoc-zh/reference/filesystem reference.xml
Log:
Update.
Index: phpdoc-zh/reference/filesystem/reference.xml diff -u phpdoc-zh/reference/filesystem/reference.xml:1.3 phpdoc-zh/reference/filesystem/reference.xml:1.4 --- phpdoc-zh/reference/filesystem/reference.xml:1.3 Thu Sep 26 23:49:11 2002 +++ phpdoc-zh/reference/filesystem/reference.xml Sun Sep 29 22:56:19 2002 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> -<!-- $Author: dallas $ --> -<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> +<!-- $Revision: 1.4 $ --> +<!-- $Author: dallas $ --> +<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> <reference id="ref.filesystem"> <title>Îļþϵͳº¯Êý¿â</title> <titleabbrev>Filesystem</titleabbrev> @@ -22,60 +22,7 @@ &reftitle.install; &no.install; </section> - - <section id="filesystem.configuration"> - &reftitle.runtime; - &extension.runtime; - <para> - <table> - <title>ÎļþϵͳºÍÁ÷ÅäÖÃÑ¡Ïî</title> - <tgroup cols="3"> - <thead> - <row> - <entry>Ãû³Æ</entry> - <entry>ĬÈÏÖµ</entry> - <entry>×÷Ó÷¶Î§</entry> - </row> - </thead> - <tbody> - <row> - <entry>auto_detect_line_endings</entry> - <entry>"Off"</entry> - <entry>PHP_INI_ALL</entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - ÕâÀïÊǶÔÅäÖÃÖ¸ÁîµÄÒ»¸ö¼òµ¥½â˵¡£ - <variablelist> - <varlistentry id="ini.auto-detect-line-endings"> - <term> - <parameter>auto_detect_line_endings</parameter> - <type>boolean</type> - </term> - <listitem> - <para> - µ±ÉèΪ On ʱ£¬PHP ½«¼ì²éͨ¹ý - <function>fgets</function> ºÍ <function>file</function> - È¡µÃµÄÊý¾ÝÖеÄÐнáÊø·ûºÅÊÇ·ûºÏ Unix£¬MS-Dos£¬»¹ÊÇ Macintosh µÄϰ¹ß¡£ - </para> - <para> - ÕâʹµÃ PHP ¿ÉÒÔºÍ Macintosh ϵͳ½»»¥²Ù×÷£¬µ«ÊÇĬÈÏÖµÊÇ Off£¬ÒòΪÔÚ¼ì²âµÚÒ»ÐÐµÄ - EOL ϰ¹ßʱ»áÓкÜСµÄÐÔÄÜËðʧ£¬¶øÇÒÔÚ Unix - ϵͳÏÂʹÓûسµ·ûºÅ×÷ΪÏîÄ¿·Ö¸ô·ûµÄÈËÃÇ»áÔâÓöÏòϲ»¼æÈݵÄÐÐΪ¡£ - </para> - <note> - <simpara> - ±¾ÅäÖòÎÊýÊÇ PHP 4.3 Òý½øµÄ¡£ - </simpara> - </note> - </listitem> - </varlistentry> - </variablelist> - </para> - </section> + &reference.filesystem.ini; <section id="filesystem.resources"> &reftitle.resources; Index: phpdoc-zh/reference/filesystem/ini.xml +++ phpdoc-zh/reference/filesystem/ini.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.1 Maintainer: dallas Status: ready --> <section id="filesystem.configuration"> &reftitle.runtime; &extension.runtime; <para> <table> <title>ÎļþϵͳºÍÁ÷ÅäÖÃÑ¡Ïî</title> <tgroup cols="3"> <thead> <row> <entry>Ãû³Æ</entry> <entry>ĬÈÏÖµ</entry> <entry>×÷Ó÷¶Î§</entry> </row> </thead> <tbody> <row> <entry>allow_url_fopen</entry> <entry>"1"</entry> <entry>PHP_INI_ALL</entry> </row> <row> <entry>user_agent</entry> <entry>NULL</entry> <entry>PHP_INI_ALL</entry> </row> <row> <entry>default_socket_timeout</entry> <entry>"60"</entry> <entry>PHP_INI_ALL</entry> </row> <row> <entry>from</entry> <entry>NULL</entry> <entry>??</entry> </row> <row> <entry>auto_detect_line_endings</entry> <entry>"Off"</entry> <entry>PHP_INI_ALL</entry> </row> </tbody> </tgroup> </table> </para> <para> ÕâÀïÊǶÔÅäÖÃÖ¸ÁîµÄһЩ¼òµ¥½â˵¡£ <variablelist> <varlistentry id="ini.allow-url-fopen"> <term> <parameter>allow_url_fopen</parameter> <type>boolean</type> </term> <listitem> <para> ±¾Ñ¡Ï»îÁË URL ÐÎʽµÄ fopen ·â×°ÐÒéʹµÃ¿ÉÒÔ·ÃÎÊ URL ¶ÔÏóÀýÈçÎļþ¡£Ä¬Èϵķâ×°ÐÒéÌṩÓà ftp ºÍ http ÐÒéÀ´·ÃÎÊ<link linkend="features.remote-files">Ô¶³ÌÎļþ</link>£¬Ò»Ð©À©Õ¹¿âÀýÈç <link linkend="ref.zlib">zlib</link> ¿ÉÄÜ»á×¢²á¸ü¶àµÄ·â×°ÐÒé¡£ </para> <note> <para> ±¾Ñ¡ÏîÊǰ汾 4.0.3 ·¢ÐкóÁ¢¼´Òý½øµÄ¡£4.0.3 ÒÔ¼°ÒÔǰµÄ°æ±¾Ö»ÄÜÔÚ±àÒëʱͨ¹ýÅäÖÃÏî <link linkend="install.configure.disable-url-fopen-wrapper"><parameter> --disable-url-fopen-wrapper</parameter></link> À´È¡Ïû´ËÌØÐÔ¡£ </para> </note> <warning> <para> Windows °æÔÚ PHP 4.3 ֮ǰ£¬ÏÂÁк¯Êý²»Ö§³ÖÔ¶³ÌÎļþ·ÃÎÊ£º<function>include</function>£¬<function>include_once</function>, <function>require</function>£¬<function>require_once</function> ºÍ <xref linkend="ref.image"/> À©Õ¹¿âÖÐµÄ imagecreatefromXXX º¯Êý¡£ </para> </warning> </listitem> </varlistentry> <varlistentry id="ini.user-agent"> <term> <parameter>user_agent</parameter> <type>string</type> </term> <listitem> <para> ¶¨Òå <literal>PHP</literal> ·¢Ë굀 User-Agent¡£ </para> </listitem> </varlistentry> <varlistentry id="ini.default-socket-timeout"> <term> <parameter>default_socket_timeout</parameter> <type>integer</type> </term> <listitem> <para> »ùÓÚ socket µÄÁ÷µÄĬÈϳ¬Ê±Ê±¼ä£¨Ã룩¡£ </para> <note> <simpara> ±¾ÅäÖòÎÊýÊÇ PHP 4.3 Òý½øµÄ¡£ </simpara> </note> </listitem> </varlistentry> <varlistentry id="ini.from"> <term> <parameter>from="joe@example.com"</parameter> <type>string</type> </term> <listitem> <para> ¶¨ÒåÄäÃû ftp µÄÃÜÂ루ÄãµÄ email µØÖ·£©¡£ </para> </listitem> </varlistentry> <varlistentry id="ini.auto-detect-line-endings"> <term> <parameter>auto_detect_line_endings</parameter> <type>boolean</type> </term> <listitem> <para> µ±ÉèΪ On ʱ£¬PHP ½«¼ì²éͨ¹ý <function>fgets</function> ºÍ <function>file</function> È¡µÃµÄÊý¾ÝÖеÄÐнáÊø·ûºÅÊÇ·ûºÏ Unix£¬MS-Dos£¬»¹ÊÇ Macintosh µÄϰ¹ß¡£ </para> <para> ÕâʹµÃ PHP ¿ÉÒÔºÍ Macintosh ϵͳ½»»¥²Ù×÷£¬µ«ÊÇĬÈÏÖµÊÇ Off£¬ÒòΪÔÚ¼ì²âµÚÒ»ÐÐµÄ EOL ϰ¹ßʱ»áÓкÜСµÄÐÔÄÜËðʧ£¬¶øÇÒÔÚ Unix ϵͳÏÂʹÓûسµ·ûºÅ×÷ΪÏîÄ¿·Ö¸ô·ûµÄÈËÃÇ»áÔâÓöÏòϲ»¼æÈݵÄÐÐΪ¡£ </para> <note> <simpara> ±¾ÅäÖòÎÊýÊÇ PHP 4.3 Òý½øµÄ¡£ </simpara> </note> </listitem> </varlistentry> </variablelist> </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/flock.xml +++ phpdoc-zh/reference/filesystem/functions/flock.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.flock"> <refnamediv> <refname>flock</refname> <refpurpose>Portable advisory file locking</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>flock</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>operation</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>&wouldblock</parameter></methodparam> </methodsynopsis> <simpara> PHP supports a portable way of locking complete files in an advisory way (which means all accessing programs have to use the same way of locking or it will not work). </simpara> <simpara> <function>flock</function> operates on <parameter>fp</parameter> which must be an open file pointer. <parameter>operation</parameter> is one of the following values: </simpara> <para> <itemizedlist> <listitem> <simpara> To acquire a shared lock (reader), set <parameter>operation</parameter> to LOCK_SH (set to 1 prior to PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> To acquire an exclusive lock (writer), set <parameter>operation</parameter> to LOCK_EX (set to 2 prior to PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> To release a lock (shared or exclusive), set <parameter>operation</parameter> to LOCK_UN (set to 3 prior to PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> If you don't want <function>flock</function> to block while locking, add LOCK_NB (4 prior to PHP 4.0.1) to <parameter>operation</parameter>. </simpara> </listitem> </itemizedlist> </para> <simpara> <function>flock</function> allows you to perform a simple reader/writer model which can be used on virtually every platform (including most Unix derivatives and even Windows). The optional third argument is set to &true; if the lock would block (EWOULDBLOCK errno condition) </simpara> <simpara> <function>flock</function> returns &true; on success and &false; on error (e.g. when a lock could not be acquired). </simpara> <note> <para> Because <function>flock</function> requires a file pointer, you may have to use a special lock file to protect access to a file that you intend to truncate by opening it in write mode (with a "w" or "w+" argument to <function>fopen</function>). </para> </note> <warning> <para> <function>flock</function> will not work on NFS and many other networked file systems. Check your operating system documentation for more details. </para> <para> On some operating systems <function>flock</function> is implemented at the process level. When using a multithreaded server API like ISAPI you may not be able to rely on <function>flock</function> to protect files against other PHP scripts running in parallel threads of the same server instance! </para> <para> <function>flock</function> is not supported on antiquated filesystems like <literal>FAT</literal> and its derivates and will therefore always return &false; under this environments (this is especially true for Windows 98 users). </para> </warning> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fnmatch.xml +++ phpdoc-zh/reference/filesystem/functions/fnmatch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.fnmatch"> <refnamediv> <refname>fnmatch</refname> <refpurpose>Match filename against a pattern</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>fnmatch</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> </methodsynopsis> <para> <function>fnmatch</function> checks if the passed <parameter>string</parameter> would match the given shell wildcard <parameter>pattern</parameter>. </para> <para> This is especialy usefull for filenames, but may also be used on regular strings. The average user may be used to shell patterns or at least in their simplest form to <literal>'?'</literal> and <literal>'*'</literal> wildcards so using <function>fnmatch</function> instead of <function>ereg</function> or <function>preg_match</function> for frontend search expression input may be way more convenient for non-programming users. </para> <example> <title> Checking a color name against a shell wildcard pattern. </title> <programlisting role="php"> <![CDATA[ if(fnmatch("*gr[ae]y", $color)) { echo "some form of gray ..."; } ]]> </programlisting> </example> <para> See also <function>glob</function>, <function>ereg</function>, <function>preg_match</function> and the unix manpage on <literal>fnmatch(3)</literal> for flag names (as long as they are not documented here <!-- TODO hartmut -->). </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fopen.xml +++ phpdoc-zh/reference/filesystem/functions/fopen.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fopen"> <refnamediv> <refname>fopen</refname> <refpurpose>Opens file or URL</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fopen</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam><type>string</type><parameter>mode</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam> <methodparam choice="opt"><type>resource</type><parameter>zcontext</parameter></methodparam> </methodsynopsis> <simpara> <function>fopen</function> binds a named resource, specified by <parameter>filename</parameter>, to a stream. If <parameter>filename</parameter> is of the form "scheme://...", it is assumed to be a URL and PHP will search for a protocol handler (also known as a wrapper) for that scheme. If no wrappers for that protocol are registered, PHP will emit a notice to help you track potential problems in your script and then continue as though <parameter>filename</parameter> specifies a regular file. </simpara> <simpara> If PHP has decided that <parameter>filename</parameter> specifies a local file, then it will try to open a stream on that file. The file must be accessible to PHP, so you need to ensure that the file access permissions allow this access. If you have enabled <link linkend="ini.safe-mode">safe_mode</link>, or <link linkend="ini.open-basedir">open_basedir</link> further restrictions may apply. </simpara> <simpara> If PHP has decided that <parameter>filename</parameter> specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that <link linkend="ini.allow-url-fopen">allow_url_fopen</link> is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail. </simpara> <note> <simpara> The list of supported protocols can be found in <xref linkend="wrappers"/>. </simpara> </note> <para> <parameter>mode</parameter> specifies the type of access you require to the stream. It may be any of the following: <itemizedlist> <listitem> <simpara> 'r' - Open for reading only; place the file pointer at the beginning of the file. </simpara> </listitem> <listitem> <simpara> 'r+' - Open for reading and writing; place the file pointer at the beginning of the file. </simpara> </listitem> <listitem> <simpara> 'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. </simpara> </listitem> <listitem> <simpara> 'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. </simpara> </listitem> <listitem> <simpara> 'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. </simpara> </listitem> <listitem> <simpara> 'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. </simpara> </listitem> </itemizedlist> </para> <note> <para> The <parameter>mode</parameter> may contain the letter 'b'. This is useful only on systems which differentiate between binary and text files (i.e. Windows. It's useless on Unix). If not needed, this will be ignored. You are encouraged to include the 'b' flag in order to make your scripts more portable. </para> </note> <para> The optional third <parameter>use_include_path</parameter> parameter can be set to '1' or &true; if you want to search for the file in the <link linkend="ini.include-path">include_path</link>, too. </para> <para> The optional fourth <parameter>zcontext</parameter> is used for specifying tuning parameters and callbacks. </para> <simpara> If the open fails, the function returns &false;. </simpara> <para> <example> <title><function>fopen</function> example</title> <programlisting role="php"> <![CDATA[ <?php $fp = fopen ("/home/rasmus/file.txt", "r"); $fp = fopen ("/home/rasmus/file.gif", "wb"); $fp = fopen ("http://www.example.com/", "r"); $fp = fopen ("ftp://user:password@example.com/", "w"); ?> ]]> </programlisting> </example> </para> <simpara> If you are experiencing problems with reading and writing to files and you're using the server module version of PHP, remember to make sure that the files and directories you're using are accessible to the server process. </simpara> <para> On the Windows platform, be careful to escape any backslashes used in the path to the file, or use forward slashes. <informalexample> <programlisting role="php"> <![CDATA[ <?php $fp = fopen ("c:\\data\\info.txt", "r"); ?> ]]> </programlisting> </informalexample> </para> <simpara> See also <xref linkend="wrappers"/>, <function>fclose</function>, <function>fgets</function>, <function>fsockopen</function>, <function>file</function>, <function>file_exists</function>, <function>is_readable</function>, <function>socket_set_timeout</function>, and <function>popen</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fpassthru.xml +++ phpdoc-zh/reference/filesystem/functions/fpassthru.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fpassthru"> <refnamediv> <refname>fpassthru</refname> <refpurpose>Output all remaining data on a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fpassthru</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <simpara> Reads to EOF on the given file pointer from the current position and writes the results to the output buffer. </simpara> <simpara> If an error occurs, <function>fpassthru</function> returns &false;. </simpara> <simpara> The file pointer must be valid, and must point to a file successfully opened by <function>fopen</function>, <function>popen</function>, or <function>fsockopen</function>. You may need to call <function>rewind</function> to reset the file pointer to the beginning of the file if you have already written data to the file. The file is closed when <function>fpassthru</function> is done reading it (leaving <parameter>fp</parameter> useless). </simpara> <simpara> If you just want to dump the contents of a file to the output buffer, without first modifying it or seeking to a particular offset, you may want to use the <function>readfile</function>, which saves you the <function>fopen</function> call. </simpara> <note> <para> When using <function>fpassthru</function> on a binary file on Windows systems, you should make sure to open the file in binary mode by appending a <literal>b</literal> to the mode used in the call to <function>fopen</function>. </para> <para> You are encouraged to use the <literal>b</literal> flag when dealing with binary files, even if your system does not require it, so that your scripts will be more portable. </para> </note> <simpara> See also <function>readfile</function>, <function>fopen</function>, <function>popen</function>, and <function>fsockopen</function> </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fputs.xml +++ phpdoc-zh/reference/filesystem/functions/fputs.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fputs"> <refnamediv> <refname>fputs</refname> <refpurpose>Writes to a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fputs</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>string</type><parameter>str</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> </methodsynopsis> <para> <function>fputs</function> is an alias to <function>fwrite</function>, and is identical in every way. Note that the <parameter>length</parameter> parameter is optional and if not specified the entire string will be written. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fread.xml +++ phpdoc-zh/reference/filesystem/functions/fread.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.25 --> <refentry id="function.fread"> <refnamediv> <refname>fread</refname> <refpurpose>Binary-safe file read</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>fread</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>length</parameter></methodparam> </methodsynopsis> <simpara> <function>fread</function> reads up to <parameter>length</parameter> bytes from the file pointer referenced by <parameter>fp</parameter>. Reading stops when <parameter>length</parameter> bytes have been read or EOF is reached, whichever comes first. </simpara> <para> <informalexample> <programlisting role="php"> <![CDATA[ // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); ]]> </programlisting> </informalexample> </para> <note> <para> On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in <function>fopen</function> mode parameter. </para> </note> <para> <informalexample> <programlisting role="php"> <![CDATA[ $filename = "c:\\files\\somepic.gif"; $fd = fopen ($filename, "rb"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); ]]> </programlisting> </informalexample> </para> <simpara> See also <function>fwrite</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, <function>fgets</function>, <function>fgetss</function>, <function>fscanf</function>, <function>file</function>, and <function>fpassthru</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fscanf.xml +++ phpdoc-zh/reference/filesystem/functions/fscanf.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fscanf"> <refnamediv> <refname>fscanf</refname> <refpurpose>Parses input from a file according to a format</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>mixed</type><methodname>fscanf</methodname> <methodparam><type>int</type><parameter>handle</parameter></methodparam> <methodparam><type>string</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>var1</parameter></methodparam> </methodsynopsis> <para> The function <function>fscanf</function> is similar to <function>sscanf</function>, but it takes its input from a file associated with <parameter>handle</parameter> and interprets the input according to the specified <parameter>format</parameter>. If only two parameters were passed to this function, the values parsed will be returned as an array. Otherwise, if optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference. </para> <para> Any whitespace in the format string matches any whitespace in the input stream. This means that even a tab <literal>\t</literal> in the format string can match a single space character in the input stream. </para> <para> <example> <title><function>fscanf</function> Example</title> <programlisting role="php"> <![CDATA[ $fp = fopen ("users.txt","r"); while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) { list ($name, $profession, $countrycode) = $userinfo; //... do something with the values } fclose($fp); ]]> </programlisting> </example> <example> <title>users.txt</title> <programlisting> <![CDATA[ javier argonaut pe hiroshi sculptor jp robert slacker us luigi florist it ]]> </programlisting> </example> </para> <para> See also <function>fread</function>, <function>fgets</function>, <function>fgetss</function>, <function>sscanf</function>, <function>printf</function>, and <function>sprintf</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fseek.xml +++ phpdoc-zh/reference/filesystem/functions/fseek.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fseek"> <refnamediv> <refname>fseek</refname> <refpurpose>Seeks on a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fseek</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>offset</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>whence</parameter></methodparam> </methodsynopsis> <para> Sets the file position indicator for the file referenced by <parameter>fp</parameter>.The new position, measured in bytes from the beginning of the file, is obtained by adding <parameter>offset</parameter> to the position specified by <parameter>whence</parameter>, whose values are defined as follows: <simplelist> <member>SEEK_SET - Set position equal to <parameter>offset</parameter> bytes.</member> <member>SEEK_CUR - Set position to current location plus <parameter>offset</parameter>.</member> <member>SEEK_END - Set position to end-of-file plus <parameter>offset</parameter>. (To move to a position before the end-of-file, you need to pass a negative value in <parameter>offset</parameter>.)</member> </simplelist> </para> <para>If <parameter>whence</parameter> is not specified, it is assumed to be SEEK_SET. </para> <para> Upon success, returns 0; otherwise, returns -1. Note that seeking past EOF is not considered an error. </para> <para> May not be used on file pointers returned by <function>fopen</function> if they use the "http://" or "ftp://" formats. </para> <note> <para> The <parameter>whence</parameter> argument was added after PHP 4.0.0. </para> </note> <para> See also <function>ftell</function> and <function>rewind</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fstat.xml +++ phpdoc-zh/reference/filesystem/functions/fstat.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.24 --> <refentry id="function.fstat"> <refnamediv> <refname>fstat</refname> <refpurpose>Gets information about a file using an open file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>fstat</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Gathers the statistics of the file opened by the file pointer fp. This function is similar to the <function>stat</function> function except that it operates on an open file pointer instead of a filename. </para> <para> Returns an array with the statistics of the file with the following elements: <orderedlist> <listitem><simpara>device</simpara></listitem> <listitem><simpara>inode</simpara></listitem> <listitem><simpara>number of links</simpara></listitem> <listitem><simpara>user id of owner</simpara></listitem> <listitem><simpara>group id owner</simpara></listitem> <listitem><simpara>device type if inode device *</simpara></listitem> <listitem><simpara>size in bytes</simpara></listitem> <listitem><simpara>time of last access</simpara></listitem> <listitem><simpara>time of last modification</simpara></listitem> <listitem><simpara>time of last change</simpara></listitem> <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem> <listitem><simpara>number of blocks allocated</simpara></listitem> </orderedlist> * - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1 </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/ftell.xml +++ phpdoc-zh/reference/filesystem/functions/ftell.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.ftell"> <refnamediv> <refname>ftell</refname> <refpurpose>Tells file pointer read/write position</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>ftell</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Returns the position of the file pointer referenced by fp; i.e., its offset into the file stream. </para> <para> If an error occurs, returns &false;. </para> <para> The file pointer must be valid, and must point to a file successfully opened by <function>fopen</function> or <function>popen</function>. </para> <para> See also <function>fopen</function>, <function>popen</function>, <function>fseek</function>, and <function>rewind</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/ftruncate.xml +++ phpdoc-zh/reference/filesystem/functions/ftruncate.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.14 --> <refentry id="function.ftruncate"> <refnamediv> <refname>ftruncate</refname> <refpurpose>Truncates a file to a given length</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>ftruncate</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>size</parameter></methodparam> </methodsynopsis> <para> Takes the filepointer, <parameter>fp</parameter>, and truncates the file to length, <parameter>size</parameter>. This function returns &true; on success and &false; on failure. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fwrite.xml +++ phpdoc-zh/reference/filesystem/functions/fwrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fwrite"> <refnamediv> <refname>fwrite</refname> <refpurpose>Binary-safe file write</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fwrite</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> </methodsynopsis> <simpara> <function>fwrite</function> writes the contents of <parameter>string</parameter> to the file stream pointed to by <parameter>fp</parameter>. If the <parameter>length</parameter> argument is given, writing will stop after <parameter>length</parameter> bytes have been written or the end of <parameter>string</parameter> is reached, whichever comes first. </simpara> <simpara> <function>fwrite</function> returns the number of bytes written, or -1 on error. </simpara> <simpara> Note that if the <parameter>length</parameter> argument is given, then the <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link> configuration option will be ignored and no slashes will be stripped from <parameter>string</parameter>. </simpara> <note> <para> On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in <function>fopen</function> mode parameter. </para> </note> <simpara> See also <function>fread</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, and <function>fputs</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/glob.xml +++ phpdoc-zh/reference/filesystem/functions/glob.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.glob"> <refnamediv> <refname>glob</refname> <refpurpose>Find pathnames matching a pattern</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>glob</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> </methodsynopsis> <para> The <function>glob</function> function searches for all the pathnames matching <parameter>pattern</parameter> according to the rules used by the shell. No tilde expansion or parameter substitution is done. </para> <para> Returns an array containing the matched files/directories or &false; on error. </para> <example> <title> Convenient way how <function>glob</function> can replace <function>opendir</function> and friends. </title> <programlisting role="php"> <![CDATA[ foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ]]> </programlisting> <para> This could result in the following output: </para> <screen> funclist.txt size 44686 funcsummary.txt size 267625 quickref.txt size 137820 </screen> </example> <para> See also <function>opendir</function>, <function>readdir</function> and <function>closedir</function>, <function>fnmatch</function> and the unix manpage on <literal>glob(3)</literal> for flag names (as long as they are not documented here <!-- TODO hartmut -->). </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-dir.xml +++ phpdoc-zh/reference/filesystem/functions/is-dir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-dir"> <refnamediv> <refname>is_dir</refname> <refpurpose>Tells whether the filename is a directory</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_dir</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is a directory. If <parameter>filename</parameter> is a relative filename, it will be checked relative to the current working directory. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>chdir</function>, <link linkend="class.dir">dir</link>, <function>opendir</function>, <function>is_file</function> and <function>is_link</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-executable.xml +++ phpdoc-zh/reference/filesystem/functions/is-executable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-executable"> <refnamediv> <refname>is_executable</refname> <refpurpose>Tells whether the filename is executable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_executable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is executable. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_file</function> and <function>is_link</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-file.xml +++ phpdoc-zh/reference/filesystem/functions/is-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-file"> <refnamediv> <refname>is_file</refname> <refpurpose>Tells whether the filename is a regular file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is a regular file. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_dir</function> and <function>is_link</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-link.xml +++ phpdoc-zh/reference/filesystem/functions/is-link.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-link"> <refnamediv> <refname>is_link</refname> <refpurpose>Tells whether the filename is a symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_link</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is a symbolic link. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <para> See also <function>is_dir</function>, <function>is_file</function>, and <function>readlink</function>. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-readable.xml +++ phpdoc-zh/reference/filesystem/functions/is-readable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-readable"> <refnamediv> <refname>is_readable</refname> <refpurpose>Tells whether the filename is readable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_readable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is readable. </para> <para> Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_writable</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-uploaded-file.xml +++ phpdoc-zh/reference/filesystem/functions/is-uploaded-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.39 --> <refentry id="function.is-uploaded-file"> <refnamediv> <refname>is_uploaded_file</refname> <refpurpose>Tells whether the file was uploaded via HTTP POST</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_uploaded_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the file named by <varname>filename</varname> was uploaded via HTTP POST. This is useful to help ensure that a malicious user hasn't tried to trick the script into working on files upon which it should not be working--for instance, <filename>/etc/passwd</filename>. </para> <para> This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system. </para> <para> <function>is_uploaded_file</function> is available only in versions of PHP 3 after PHP 3.0.16, and in versions of PHP 4 after 4.0.2. If you are stuck using an earlier version, you can use the following function to help protect yourself: <note> <para> The following example will <emphasis>not</emphasis> work in versions of PHP 4 after 4.0.2. It depends on internal functionality of PHP which changed after that version. </para> </note> <programlisting role="php"> <![CDATA[ <?php /* Userland test for uploaded file. */ function is_uploaded_file($filename) { if (!$tmp_file = get_cfg_var('upload_tmp_dir')) { $tmp_file = dirname(tempnam('', '')); } $tmp_file .= '/' . basename($filename); /* User might have trailing slash in php.ini... */ return (ereg_replace('/+', '/', $tmp_file) == $filename); } /* This is how to use it, since you also don't have * move_uploaded_file() in these older versions: */ if (is_uploaded_file($HTTP_POST_FILES['userfile'])) { copy($HTTP_POST_FILES['userfile'], "/place/to/put/uploaded/file"); } else { echo "Possible file upload attack: filename '$HTTP_POST_FILES[userfile]'."; } ?> ]]> </programlisting> </para> <para> See also <function>move_uploaded_file</function>, and the section <link linkend="features.file-upload">Handling file uploads</link> for a simple usage example. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-writable.xml +++ phpdoc-zh/reference/filesystem/functions/is-writable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-writable"> <refnamediv> <refname>is_writable</refname> <refpurpose>Tells whether the filename is writable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_writable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is writable. The filename argument may be a directory name allowing you to check if a directory is writeable. </para> <para> Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_readable</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-writeable.xml +++ phpdoc-zh/reference/filesystem/functions/is-writeable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.55 --> <refentry id="function.is-writeable"> <refnamediv> <refname>is_writeable</refname> <refpurpose>Tells whether the filename is writable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_writeable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> This is an alias for <function>is_writable</function> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/link.xml +++ phpdoc-zh/reference/filesystem/functions/link.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.link"> <refnamediv> <refname>link</refname> <refpurpose>Create a hard link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>link</methodname> <methodparam><type>string</type><parameter>target</parameter></methodparam> <methodparam><type>string</type><parameter>link</parameter></methodparam> </methodsynopsis> <para> <function>link</function> creates a hard link.</para> <para> See also the <function>symlink</function> to create soft links, and <function>readlink</function> along with <function>linkinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/linkinfo.xml +++ phpdoc-zh/reference/filesystem/functions/linkinfo.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.linkinfo"> <refnamediv> <refname>linkinfo</refname> <refpurpose>Gets information about a link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>linkinfo</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>linkinfo</function> returns the st_dev field of the UNIX C stat structure returned by the lstat system call. This function is used to verify if a link (pointed to by <parameter>path</parameter>) really exists (using the same method as the S_ISLNK macro defined in stat.h). Returns 0 or &false; in case of error. </para> <para> See also <function>symlink</function>, <function>link</function>, and <function>readlink</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/lstat.xml +++ phpdoc-zh/reference/filesystem/functions/lstat.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.lstat"> <refnamediv> <refname>lstat</refname> <refpurpose>Gives information about a file or symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>lstat</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Gathers the statistics of the file or symbolic link named by filename. This function is identical to the <function>stat</function> function except that if the <parameter>filename</parameter> parameter is a symbolic link, the status of the symbolic link is returned, not the status of the file pointed to by the symbolic link. </para> <para> Returns an array with the statistics of the file with the following elements: <orderedlist> <listitem><simpara>device</simpara></listitem> <listitem><simpara>inode</simpara></listitem> <listitem><simpara>inode protection mode</simpara></listitem> <listitem><simpara>number of links</simpara></listitem> <listitem><simpara>user id of owner</simpara></listitem> <listitem><simpara>group id owner</simpara></listitem> <listitem><simpara>device type if inode device *</simpara></listitem> <listitem><simpara>size in bytes</simpara></listitem> <listitem><simpara>time of last access</simpara></listitem> <listitem><simpara>time of last modification</simpara></listitem> <listitem><simpara>time of last change</simpara></listitem> <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem> <listitem><simpara>number of blocks allocated</simpara></listitem> </orderedlist> * - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1. </para> <para> <function>lstat</function> cannot be used on <link linkend="features.remote-files">remote files</link>. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/mkdir.xml +++ phpdoc-zh/reference/filesystem/functions/mkdir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.39 --> <refentry id="function.mkdir"> <refnamediv> <refname>mkdir</refname> <refpurpose>Makes directory</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>mkdir</methodname> <methodparam><type>string</type><parameter>pathname</parameter></methodparam> <methodparam><type>int</type><parameter>mode</parameter></methodparam> </methodsynopsis> <para> Attempts to create the directory specified by pathname. </para> <para> Note that you probably want to specify the mode as an octal number, which means it should have a leading zero. The mode is also modified by the current umask, which you can change using <function>umask</function>. <informalexample> <programlisting role="php"> <![CDATA[ mkdir ("/path/to/my/dir", 0700); ]]> </programlisting> </informalexample> </para> <para> &return.success; </para> <para> See also <function>rmdir</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/move-uploaded-file.xml +++ phpdoc-zh/reference/filesystem/functions/move-uploaded-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.move-uploaded-file"> <refnamediv> <refname>move_uploaded_file</refname> <refpurpose>Moves an uploaded file to a new location</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>move_uploaded_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam><type>string</type><parameter>destination</parameter></methodparam> </methodsynopsis> <para> This function checks to ensure that the file designated by <parameter>filename</parameter> is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by <parameter>destination</parameter>. </para> <para> If <parameter>filename</parameter> is not a valid upload file, then no action will occur, and <function>move_uploaded_file</function> will return &false;. </para> <para> If <parameter>filename</parameter> is a valid upload file, but cannot be moved for some reason, no action will occur, and <function>move_uploaded_file</function> will return &false;. Additionally, a warning will be issued. </para> <para> This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system. </para> ¬e.sm.uidcheck; <note> <para> <function>move_uploaded_file</function> is not affected by the normal safe-mode UID-restrictions. This is not unsafe because <function>move_uploaded_file</function> only operates on files uploaded via PHP. </para> </note> <warning> <para> If the destination file already exists, it will be overwritten. </para> </warning> <para> See also <function>is_uploaded_file</function>, and the section <link linkend="features.file-upload">Handling file uploads</link> for a simple usage example. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/parse-ini-file.xml +++ phpdoc-zh/reference/filesystem/functions/parse-ini-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.87 --> <refentry id="function.parse-ini-file"> <refnamediv> <refname>parse_ini_file</refname> <refpurpose>Parse a configuration file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>parse_ini_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>process_sections</parameter></methodparam> </methodsynopsis> <para> <function>parse_ini_file</function> loads in the ini file specified in <parameter>filename</parameter>, and returns the settings in it in an associative array. By setting the last <parameter>process_sections</parameter> parameter to &true;, you get a multidimensional array, with the section names and settings included. The default for <parameter>process_sections</parameter> is &false; </para> <note> <para> This function has nothing to do with the &php.ini; file. It is already processed, the time you run your script. This function can be used to read in your own application's configuration files. </para> </note> <note> <para> If a value in the ini file contains any non-alphanumeric characters it needs to be enclosed in double-quotes ("). </para> </note> <note> <simpara> Since PHP 4.2.1 this function is also affected by <link linkend="ini.safe-mode">safe_mode</link> and <link linkend="ini.open-basedir">open_basedir</link>. </simpara> </note> <para> The structure of the ini file is similar to that of the &php.ini;'s. </para> <warning> <para> If the ini file you are trying to parse is malformed, PHP will exit. </para> </warning> <para> <example> <title>Contents of sample.ini</title> <programlisting> <![CDATA[ ; This is a sample configuration file ; Comments start with ';', as in php.ini [first_section] one = 1 five = 5 [second_section] path = /usr/local/bin URL = "http://www.example.com/~username" ]]> </programlisting> </example> </para> <para> <example> <title><function>parse_ini_file</function> example</title> <programlisting> <![CDATA[ <?php // Parse without sections $ini_array = parse_ini_file("sample.ini"); print_r($ini_array); // Parse with sections $ini_array = parse_ini_file("sample.ini", TRUE); print_r($ini_array); ?> ]]> </programlisting> </example> </para> <para> Would produce: <informalexample> <programlisting> <![CDATA[ Array ( [one] => 1 [five] => 5 [path] => /usr/local/bin [URL] => http://www.example.com/~username ) Array ( [first_section] => Array ( [one] => 1 [five] => 5 ) [second_section] => Array ( [path] => /usr/local/bin [URL] => http://www.example.com/~username ) ) ]]> </programlisting> </informalexample> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/pathinfo.xml +++ phpdoc-zh/reference/filesystem/functions/pathinfo.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.61 --> <refentry id="function.pathinfo"> <refnamediv> <refname>pathinfo</refname> <refpurpose>Returns information about a file path</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>pathinfo</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>pathinfo</function> returns an associative array containing information about <parameter>path</parameter>. The following array elements are returned: <parameter>dirname</parameter>, <parameter>basename</parameter> and <parameter>extension</parameter>. </para> <para> <example> <title><function>pathinfo</function> Example</title> <programlisting role="php"> <![CDATA[ <?php $path_parts = pathinfo("/www/htdocs/index.html"); echo $path_parts["dirname"] . "\n"; echo $path_parts["basename"] . "\n"; echo $path_parts["extension"] . "\n"; ?> ]]> </programlisting> </example> </para> <para> Would produce: <informalexample> <programlisting> <![CDATA[ /www/htdocs index.html html ]]> </programlisting> </informalexample> </para> <para> See also <function>dirname</function>, <function>basename</function>, <function>parse_url</function> and <function>realpath</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/pclose.xml +++ phpdoc-zh/reference/filesystem/functions/pclose.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.pclose"> <refnamediv> <refname>pclose</refname> <refpurpose>Closes process file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>pclose</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Closes a file pointer to a pipe opened by <function>popen</function>. </para> <para> The file pointer must be valid, and must have been returned by a successful call to <function>popen</function>. </para> <para> Returns the termination status of the process that was run. </para> <para> See also <function>popen</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/popen.xml +++ phpdoc-zh/reference/filesystem/functions/popen.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.popen"> <refnamediv> <refname>popen</refname> <refpurpose>Opens process file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>popen</methodname> <methodparam><type>string</type><parameter>command</parameter></methodparam> <methodparam><type>string</type><parameter>mode</parameter></methodparam> </methodsynopsis> <para> Opens a pipe to a process executed by forking the command given by command. </para> <para> Returns a file pointer identical to that returned by <function>fopen</function>, except that it is unidirectional (may only be used for reading or writing) and must be closed with <function>pclose</function>. This pointer may be used with <function>fgets</function>, <function>fgetss</function>, and <function>fputs</function>. </para> <para> If an error occurs, returns &false;. </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ $fp = popen ("/bin/ls", "r"); ]]> </programlisting> </informalexample> </para> <note> <para> If the command to be executed could not be found, a valid resource is returned. This may seem odd, but makes sense; it allows you to access any error message returned by the shell: <informalexample> <programlisting role="php"> <![CDATA[ <?php error_reporting(E_ALL); /* Add redirection so we can get stderr. */ $fp = popen('/path/to/spooge 2>&1', 'r'); echo "'$fp'; " . gettype($fp) . "\n"; $read = fread($fp, 2096); echo $read; pclose($fp); ?> ]]> </programlisting> </informalexample> </para> </note> <para> See also <function>pclose</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/readfile.xml +++ phpdoc-zh/reference/filesystem/functions/readfile.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.readfile"> <refnamediv> <refname>readfile</refname> <refpurpose>Outputs a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>readfile</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam> </methodsynopsis> <para> Reads a file and writes it to the output buffer. </para> <para> Returns the number of bytes read from the file. If an error occurs, &false; is returned and unless the function was called as @readfile, an error message is printed. </para> &tip.fopen-wrapper; <para> You can use the optional second parameter and set it to "1", if you want to search for the file in the <link linkend="ini.include-path">include_path</link>, too. </para> <para> See also <function>fpassthru</function>, <function>file</function>, <function>fopen</function>, <function>include</function>, <function>require</function>, <function>virtual</function> and <xref linkend="wrappers"/>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/readlink.xml +++ phpdoc-zh/reference/filesystem/functions/readlink.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.readlink"> <refnamediv> <refname>readlink</refname> <refpurpose>Returns the target of a symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>readlink</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>readlink</function> does the same as the readlink C function and returns the contents of the symbolic link path or 0 in case of error. </para> <para> See also <function>is_link</function>, <function>symlink</function>, and <function>linkinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/realpath.xml +++ phpdoc-zh/reference/filesystem/functions/realpath.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.23 --> <refentry id="function.realpath"> <refnamediv> <refname>realpath</refname> <refpurpose>Returns canonicalized absolute pathname</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>realpath</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>realpath</function> expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the input <parameter>path</parameter> and return the canonicalized absolute pathname. The resulting path will have no symbolic link, '/./' or '/../' components. </para> <para> <function>realpath</function> returns &false; on failure, e.g. if the file does not exists. </para> <para> <example> <title><function>realpath</function> example</title> <programlisting role="php"> <![CDATA[ $real_path = realpath ("../../index.php"); ]]> </programlisting> </example> </para> <para> See also: <function>basename</function>, <function>dirname</function>, and <function>pathinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/rename.xml +++ phpdoc-zh/reference/filesystem/functions/rename.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.rename"> <refnamediv> <refname>rename</refname> <refpurpose>Renames a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>rename</methodname> <methodparam><type>string</type><parameter>oldname</parameter></methodparam> <methodparam><type>string</type><parameter>newname</parameter></methodparam> </methodsynopsis> <para> Attempts to rename <parameter>oldname</parameter> to <parameter>newname</parameter>. </para> <para> &return.success; <example> <title>Example with <function>rename</function></title> <programlisting role="php"> <![CDATA[ <?php rename("/tmp/tmp_file.txt", "/home/user/login/docs/my_file.txt"); ?> ]]> </programlisting> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/rewind.xml +++ phpdoc-zh/reference/filesystem/functions/rewind.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.rewind"> <refnamediv> <refname>rewind</refname> <refpurpose>Rewind the position of a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>rewind</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Sets the file position indicator for fp to the beginning of the file stream. </para> <para> If an error occurs, returns 0, otherwise it returns 1. </para> <para> The file pointer must be valid, and must point to a file successfully opened by <function>fopen</function>. </para> <note> <para> If you have opened the file in append ("a") mode, any data you write to the file will always be appended, regardless of the file position. </para> </note> <para> See also <function>fseek</function> and <function>ftell</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/rmdir.xml +++ phpdoc-zh/reference/filesystem/functions/rmdir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.rmdir"> <refnamediv> <refname>rmdir</refname> <refpurpose>Removes directory</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>rmdir</methodname> <methodparam><type>string</type><parameter>dirname</parameter></methodparam> </methodsynopsis> <para> Attempts to remove the directory named by <parameter>dirname</parameter>. The directory must be empty, and the relevant permissions must permit this. &return.success; </para> <para> See also <function>mkdir</function> and <function>unlink</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/set-file-buffer.xml +++ phpdoc-zh/reference/filesystem/functions/set-file-buffer.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.set-file-buffer"> <refnamediv> <refname>set_file_buffer</refname> <refpurpose>Alias of <function>stream_set_write_buffer</function></refpurpose> </refnamediv> <refsect1> <title>Description</title> <simpara> This function is an alias of <function>stream_set_write_buffer</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stat.xml +++ phpdoc-zh/reference/filesystem/functions/stat.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.stat"> <refnamediv> <refname>stat</refname> <refpurpose>Gives information about a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>stat</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Gathers the statistics of the file named by filename. </para> <para> Returns an array with the statistics of the file with the following elements: <orderedlist> <listitem><simpara>device</simpara></listitem> <listitem><simpara>inode</simpara></listitem> <listitem><simpara>inode protection mode</simpara></listitem> <listitem><simpara>number of links</simpara></listitem> <listitem><simpara>user id of owner</simpara></listitem> <listitem><simpara>group id owner</simpara></listitem> <listitem><simpara>device type if inode device *</simpara></listitem> <listitem><simpara>size in bytes</simpara></listitem> <listitem><simpara>time of last access</simpara></listitem> <listitem><simpara>time of last modification</simpara></listitem> <listitem><simpara>time of last change</simpara></listitem> <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem> <listitem><simpara>number of blocks allocated</simpara></listitem> </orderedlist> * - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1. </para> <para> Returns &false; in case of error. </para> <para> <function>stat</function> cannot be used on <link linkend="features.remote-files">remote files</link>. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stream-set-blocking.xml +++ phpdoc-zh/reference/filesystem/functions/stream-set-blocking.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/network.xml, last change in rev 1.2 --> <refentry id="function.stream-set-blocking"> <refnamediv> <refname>stream_set_blocking</refname> <refpurpose>Set blocking/non-blocking mode on a stream</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>stream_set_blocking</methodname> <methodparam><type>resource</type><parameter>stream</parameter></methodparam> <methodparam><type>int</type><parameter>mode</parameter></methodparam> </methodsynopsis> <para> If <parameter>mode</parameter> is &false;, the given stream will be switched to non-blocking mode, and if &true;, it will be switched to blocking mode. This affects calls like <function>fgets</function> and <function>fread</function> that read from the stream. In non-blocking mode an <function>fgets</function> call will always return right away while in blocking mode it will wait for data to become available on the stream. </para> <para> This function was previously called as <function>set_socket_blocking</function> and later <function>socket_set_blocking</function> but this usage is deprecated. </para> <note> <simpara> Prior to PHP 4.3, this function only worked on socket based streams. Since PHP 4.3, this function works for any stream that supports non-blocking mode (currently, regular files and socket streams). </simpara> </note> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stream-set-timeout.xml +++ phpdoc-zh/reference/filesystem/functions/stream-set-timeout.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/network.xml, last change in rev 1.18 --> <refentry id="function.stream-set-timeout"> <refnamediv> <refname>stream_set_timeout</refname> <refpurpose>Set timeout period on a stream</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>stream_set_timeout</methodname> <methodparam><type>resource</type><parameter>stream</parameter></methodparam> <methodparam><type>int</type><parameter>seconds</parameter></methodparam> <methodparam><type>int</type><parameter>microseconds</parameter></methodparam> </methodsynopsis> <para> Sets the timeout value on <parameter>stream</parameter>, expressed in the sum of <parameter>seconds</parameter> and <parameter>microseconds</parameter>. <example> <title><function>stream_set_timeout</function> Example</title> <programlisting role="php"> <![CDATA[ <?php $fp = fsockopen("www.example.com", 80); if(!$fp) { echo "Unable to open\n"; } else { fputs($fp, "GET / HTTP/1.0\n\n"); $start = time(); socket_set_timeout($fp, 2); $res = fread($fp, 2000); var_dump(stream_get_meta_data($fp)); fclose($fp); print $res; } ?> ]]> </programlisting> </example> </para> <note> <simpara> As of PHP 4.3, this function can (potentially) work on any kind of stream. In PHP 4.3, socket based streams are still the only kind supported in the PHP core, although streams from other extensions may support this function. </simpara> </note> <para> This function was previously called as <function>set_socket_timeout</function> and later <function>socket_set_timeout</function> but this usage is deprecated. </para> <para> See also: <function>fsockopen</function> and <function>fopen</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stream-set-write-buffer.xml +++ phpdoc-zh/reference/filesystem/functions/stream-set-write-buffer.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.stream-set-write-buffer"> <refnamediv> <refname>stream_set_write_buffer</refname> <refpurpose>Sets file buffering on the given stream</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>stream_set_write_buffer</methodname> <methodparam><type>resource</type><parameter>stream</parameter></methodparam> <methodparam><type>int</type><parameter>buffer</parameter></methodparam> </methodsynopsis> <simpara> Output using <function>fwrite</function> is normally buffered at 8K. This means that if there are two processes wanting to write to the same output stream (a file), each is paused after 8K of data to allow the other to write. <function>stream_set_write_buffer</function> sets the buffering for write operations on the given filepointer <parameter>stream</parameter> to <parameter>buffer</parameter> bytes. If <parameter>buffer</parameter> is 0 then write operations are unbuffered. This ensures that all writes with <function>fwrite</function> are completed before other processes are allowed to write to that output stream. </simpara> <simpara> The function returns 0 on success, or EOF if the request cannot be honored. </simpara> <para> The following example demonstrates how to use <function>stream_set_write_buffer</function> to create an unbuffered stream. <example> <title><function>stream_set_write_buffer</function> example</title> <programlisting role="php"> <![CDATA[ $fp = fopen($file, "w"); if ($fp) { stream_set_write_buffer($fp, 0); fputs($fp, $output); fclose($fp); } ]]> </programlisting> </example> </para> <simpara> See also <function>fopen</function> and <function>fwrite</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/symlink.xml +++ phpdoc-zh/reference/filesystem/functions/symlink.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.symlink"> <refnamediv> <refname>symlink</refname> <refpurpose>Creates a symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>symlink</methodname> <methodparam><type>string</type><parameter>target</parameter></methodparam> <methodparam><type>string</type><parameter>link</parameter></methodparam> </methodsynopsis> <para> <function>symlink</function> creates a symbolic link from the existing <parameter>target</parameter> with the specified name <parameter>link</parameter>. </para> <para> See also <function>link</function> to create hard links, and <function>readlink</function> along with <function>linkinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/tempnam.xml +++ phpdoc-zh/reference/filesystem/functions/tempnam.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.tempnam"> <refnamediv> <refname>tempnam</refname> <refpurpose>Create file with unique file name</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>tempnam</methodname> <methodparam><type>string</type><parameter>dir</parameter></methodparam> <methodparam><type>string</type><parameter>prefix</parameter></methodparam> </methodsynopsis> <para> Creates a file with a unique filename in the specified directory. If the directory does not exist, <function>tempnam</function> may generate a file in the system's temporary directory, and return the name of that. </para> <para> Prior to PHP 4.0.6, the behaviour of the <function>tempnam</function> function was system dependent. On Windows the TMP environment variable will override the <parameter>dir</parameter> parameter, on Linux the TMPDIR environment variable has precedence, while SVR4 will always use your <parameter>dir</parameter> parameter if the directory it points to exists. Consult your system documentation on the tempnam(3) function if in doubt. </para> <para> Returns the new temporary filename, or the &false; string on failure. <example> <title><function>tempnam</function> example</title> <programlisting role="php"> <![CDATA[ $tmpfname = tempnam ("/tmp", "FOO"); $fp = fopen($tmpfname, "w"); fwrite($fp, "writing to tempfile"); fclose($fp); // do here something unlink($tmpfname); ]]> </programlisting> </example> </para> <note> <simpara> This function's behavior changed in 4.0.3. The temporary file is also created to avoid a race condition where the file might appear in the filesystem between the time the string was generated and before the the script gets around to creating the file. Note, that you need to remove the file in case you need it no more, it is not done automatically. </simpara> </note> <para> See also <function>tmpfile</function> and <function>unlink</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/tmpfile.xml +++ phpdoc-zh/reference/filesystem/functions/tmpfile.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.32 --> <refentry id="function.tmpfile"> <refnamediv> <refname>tmpfile</refname> <refpurpose>Creates a temporary file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>tmpfile</methodname> <void/> </methodsynopsis> <para> Creates a temporary file with an unique name in write mode, returning a file handle similar to the one returned by <function>fopen</function>. The file is automatically removed when closed (using <function>fclose</function>), or when the script ends. </para> <para> For details, consult your system documentation on the <literal>tmpfile(3)</literal> function, as well as the <filename>stdio.h</filename> header file. </para> <para> <example> <title><function>tmpfile</function> example</title> <programlisting role="php"> <![CDATA[ $temp = tmpfile(); fwrite($temp, "writing to tempfile"); fclose($temp); // this removes the file ]]> </programlisting> </example> </para> <para> See also <function>tempnam</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/touch.xml +++ phpdoc-zh/reference/filesystem/functions/touch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.touch"> <refnamediv> <refname>touch</refname> <refpurpose>Sets access and modification time of file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>touch</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>time</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>atime</parameter></methodparam> </methodsynopsis> <para> Attempts to set the access and modification time of the file named by filename to the value given by time. If the option <parameter>time</parameter> is not given, uses the present time. This is equivalent to what utime (sometimes referred to as utimes) does. If the third option <parameter>atime</parameter> is present, the access time of the given filename is set to the value of <parameter>atime</parameter>. Note that the access time is always modified, regardless of the number of parameters. </para> <para> If the file does not exist, it is created. </para> <para> &return.success; <example> <title><function>touch</function> example</title> <programlisting role="php"> <![CDATA[ if (touch ($FileName)) { print "$FileName modification time has been changed to todays date and time"; } else { print "Sorry Could Not change modification time of $FileName"; } ]]> </programlisting> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/umask.xml +++ phpdoc-zh/reference/filesystem/functions/umask.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.umask"> <refnamediv> <refname>umask</refname> <refpurpose>Changes the current umask</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>umask</methodname> <methodparam><type>int</type><parameter>mask</parameter></methodparam> </methodsynopsis> <para> <function>umask</function> sets PHP's umask to mask & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished. </para> <para> <function>umask</function> without arguments simply returns the current umask. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/unlink.xml +++ phpdoc-zh/reference/filesystem/functions/unlink.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.unlink"> <refnamediv> <refname>unlink</refname> <refpurpose>Deletes a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>unlink</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Deletes <parameter>filename</parameter>. Similar to the Unix C unlink() function. </para> <para> &return.success; </para> <para> See also <function>rmdir</function> for removing directories. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
Index: phpdoc-zh/reference/filesystem/reference.xml diff -u phpdoc-zh/reference/filesystem/reference.xml:1.3 phpdoc-zh/reference/filesystem/reference.xml:1.4 --- phpdoc-zh/reference/filesystem/reference.xml:1.3 Thu Sep 26 23:49:11 2002 +++ phpdoc-zh/reference/filesystem/reference.xml Sun Sep 29 22:56:19 2002 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> -<!-- $Author: dallas $ --> -<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> +<!-- $Revision: 1.4 $ --> +<!-- $Author: dallas $ --> +<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> <reference id="ref.filesystem"> <title>Îļþϵͳº¯Êý¿â</title> <titleabbrev>Filesystem</titleabbrev> @@ -22,60 +22,7 @@ &reftitle.install; &no.install; </section> - - <section id="filesystem.configuration"> - &reftitle.runtime; - &extension.runtime; - <para> - <table> - <title>ÎļþϵͳºÍÁ÷ÅäÖÃÑ¡Ïî</title> - <tgroup cols="3"> - <thead> - <row> - <entry>Ãû³Æ</entry> - <entry>ĬÈÏÖµ</entry> - <entry>×÷Ó÷¶Î§</entry> - </row> - </thead> - <tbody> - <row> - <entry>auto_detect_line_endings</entry> - <entry>"Off"</entry> - <entry>PHP_INI_ALL</entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - ÕâÀïÊǶÔÅäÖÃÖ¸ÁîµÄÒ»¸ö¼òµ¥½â˵¡£ - <variablelist> - <varlistentry id="ini.auto-detect-line-endings"> - <term> - <parameter>auto_detect_line_endings</parameter> - <type>boolean</type> - </term> - <listitem> - <para> - µ±ÉèΪ On ʱ£¬PHP ½«¼ì²éͨ¹ý - <function>fgets</function> ºÍ <function>file</function> - È¡µÃµÄÊý¾ÝÖеÄÐнáÊø·ûºÅÊÇ·ûºÏ Unix£¬MS-Dos£¬»¹ÊÇ Macintosh µÄϰ¹ß¡£ - </para> - <para> - ÕâʹµÃ PHP ¿ÉÒÔºÍ Macintosh ϵͳ½»»¥²Ù×÷£¬µ«ÊÇĬÈÏÖµÊÇ Off£¬ÒòΪÔÚ¼ì²âµÚÒ»ÐÐµÄ - EOL ϰ¹ßʱ»áÓкÜСµÄÐÔÄÜËðʧ£¬¶øÇÒÔÚ Unix - ϵͳÏÂʹÓûسµ·ûºÅ×÷ΪÏîÄ¿·Ö¸ô·ûµÄÈËÃÇ»áÔâÓöÏòϲ»¼æÈݵÄÐÐΪ¡£ - </para> - <note> - <simpara> - ±¾ÅäÖòÎÊýÊÇ PHP 4.3 Òý½øµÄ¡£ - </simpara> - </note> - </listitem> - </varlistentry> - </variablelist> - </para> - </section> + &reference.filesystem.ini; <section id="filesystem.resources"> &reftitle.resources; Index: phpdoc-zh/reference/filesystem/ini.xml +++ phpdoc-zh/reference/filesystem/ini.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.1 Maintainer: dallas Status: ready --> <section id="filesystem.configuration"> &reftitle.runtime; &extension.runtime; <para> <table> <title>ÎļþϵͳºÍÁ÷ÅäÖÃÑ¡Ïî</title> <tgroup cols="3"> <thead> <row> <entry>Ãû³Æ</entry> <entry>ĬÈÏÖµ</entry> <entry>×÷Ó÷¶Î§</entry> </row> </thead> <tbody> <row> <entry>allow_url_fopen</entry> <entry>"1"</entry> <entry>PHP_INI_ALL</entry> </row> <row> <entry>user_agent</entry> <entry>NULL</entry> <entry>PHP_INI_ALL</entry> </row> <row> <entry>default_socket_timeout</entry> <entry>"60"</entry> <entry>PHP_INI_ALL</entry> </row> <row> <entry>from</entry> <entry>NULL</entry> <entry>??</entry> </row> <row> <entry>auto_detect_line_endings</entry> <entry>"Off"</entry> <entry>PHP_INI_ALL</entry> </row> </tbody> </tgroup> </table> </para> <para> ÕâÀïÊǶÔÅäÖÃÖ¸ÁîµÄһЩ¼òµ¥½â˵¡£ <variablelist> <varlistentry id="ini.allow-url-fopen"> <term> <parameter>allow_url_fopen</parameter> <type>boolean</type> </term> <listitem> <para> ±¾Ñ¡Ï»îÁË URL ÐÎʽµÄ fopen ·â×°ÐÒéʹµÃ¿ÉÒÔ·ÃÎÊ URL ¶ÔÏóÀýÈçÎļþ¡£Ä¬Èϵķâ×°ÐÒéÌṩÓà ftp ºÍ http ÐÒéÀ´·ÃÎÊ<link linkend="features.remote-files">Ô¶³ÌÎļþ</link>£¬Ò»Ð©À©Õ¹¿âÀýÈç <link linkend="ref.zlib">zlib</link> ¿ÉÄÜ»á×¢²á¸ü¶àµÄ·â×°ÐÒé¡£ </para> <note> <para> ±¾Ñ¡ÏîÊǰ汾 4.0.3 ·¢ÐкóÁ¢¼´Òý½øµÄ¡£4.0.3 ÒÔ¼°ÒÔǰµÄ°æ±¾Ö»ÄÜÔÚ±àÒëʱͨ¹ýÅäÖÃÏî <link linkend="install.configure.disable-url-fopen-wrapper"><parameter> --disable-url-fopen-wrapper</parameter></link> À´È¡Ïû´ËÌØÐÔ¡£ </para> </note> <warning> <para> Windows °æÔÚ PHP 4.3 ֮ǰ£¬ÏÂÁк¯Êý²»Ö§³ÖÔ¶³ÌÎļþ·ÃÎÊ£º<function>include</function>£¬<function>include_once</function>, <function>require</function>£¬<function>require_once</function> ºÍ <xref linkend="ref.image"/> À©Õ¹¿âÖÐµÄ imagecreatefromXXX º¯Êý¡£ </para> </warning> </listitem> </varlistentry> <varlistentry id="ini.user-agent"> <term> <parameter>user_agent</parameter> <type>string</type> </term> <listitem> <para> ¶¨Òå <literal>PHP</literal> ·¢Ë굀 User-Agent¡£ </para> </listitem> </varlistentry> <varlistentry id="ini.default-socket-timeout"> <term> <parameter>default_socket_timeout</parameter> <type>integer</type> </term> <listitem> <para> »ùÓÚ socket µÄÁ÷µÄĬÈϳ¬Ê±Ê±¼ä£¨Ã룩¡£ </para> <note> <simpara> ±¾ÅäÖòÎÊýÊÇ PHP 4.3 Òý½øµÄ¡£ </simpara> </note> </listitem> </varlistentry> <varlistentry id="ini.from"> <term> <parameter>from="joe@example.com"</parameter> <type>string</type> </term> <listitem> <para> ¶¨ÒåÄäÃû ftp µÄÃÜÂ루ÄãµÄ email µØÖ·£©¡£ </para> </listitem> </varlistentry> <varlistentry id="ini.auto-detect-line-endings"> <term> <parameter>auto_detect_line_endings</parameter> <type>boolean</type> </term> <listitem> <para> µ±ÉèΪ On ʱ£¬PHP ½«¼ì²éͨ¹ý <function>fgets</function> ºÍ <function>file</function> È¡µÃµÄÊý¾ÝÖеÄÐнáÊø·ûºÅÊÇ·ûºÏ Unix£¬MS-Dos£¬»¹ÊÇ Macintosh µÄϰ¹ß¡£ </para> <para> ÕâʹµÃ PHP ¿ÉÒÔºÍ Macintosh ϵͳ½»»¥²Ù×÷£¬µ«ÊÇĬÈÏÖµÊÇ Off£¬ÒòΪÔÚ¼ì²âµÚÒ»ÐÐµÄ EOL ϰ¹ßʱ»áÓкÜСµÄÐÔÄÜËðʧ£¬¶øÇÒÔÚ Unix ϵͳÏÂʹÓûسµ·ûºÅ×÷ΪÏîÄ¿·Ö¸ô·ûµÄÈËÃÇ»áÔâÓöÏòϲ»¼æÈݵÄÐÐΪ¡£ </para> <note> <simpara> ±¾ÅäÖòÎÊýÊÇ PHP 4.3 Òý½øµÄ¡£ </simpara> </note> </listitem> </varlistentry> </variablelist> </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/flock.xml +++ phpdoc-zh/reference/filesystem/functions/flock.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.flock"> <refnamediv> <refname>flock</refname> <refpurpose>Portable advisory file locking</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>flock</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>operation</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>&wouldblock</parameter></methodparam> </methodsynopsis> <simpara> PHP supports a portable way of locking complete files in an advisory way (which means all accessing programs have to use the same way of locking or it will not work). </simpara> <simpara> <function>flock</function> operates on <parameter>fp</parameter> which must be an open file pointer. <parameter>operation</parameter> is one of the following values: </simpara> <para> <itemizedlist> <listitem> <simpara> To acquire a shared lock (reader), set <parameter>operation</parameter> to LOCK_SH (set to 1 prior to PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> To acquire an exclusive lock (writer), set <parameter>operation</parameter> to LOCK_EX (set to 2 prior to PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> To release a lock (shared or exclusive), set <parameter>operation</parameter> to LOCK_UN (set to 3 prior to PHP 4.0.1). </simpara> </listitem> <listitem> <simpara> If you don't want <function>flock</function> to block while locking, add LOCK_NB (4 prior to PHP 4.0.1) to <parameter>operation</parameter>. </simpara> </listitem> </itemizedlist> </para> <simpara> <function>flock</function> allows you to perform a simple reader/writer model which can be used on virtually every platform (including most Unix derivatives and even Windows). The optional third argument is set to &true; if the lock would block (EWOULDBLOCK errno condition) </simpara> <simpara> <function>flock</function> returns &true; on success and &false; on error (e.g. when a lock could not be acquired). </simpara> <note> <para> Because <function>flock</function> requires a file pointer, you may have to use a special lock file to protect access to a file that you intend to truncate by opening it in write mode (with a "w" or "w+" argument to <function>fopen</function>). </para> </note> <warning> <para> <function>flock</function> will not work on NFS and many other networked file systems. Check your operating system documentation for more details. </para> <para> On some operating systems <function>flock</function> is implemented at the process level. When using a multithreaded server API like ISAPI you may not be able to rely on <function>flock</function> to protect files against other PHP scripts running in parallel threads of the same server instance! </para> <para> <function>flock</function> is not supported on antiquated filesystems like <literal>FAT</literal> and its derivates and will therefore always return &false; under this environments (this is especially true for Windows 98 users). </para> </warning> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fnmatch.xml +++ phpdoc-zh/reference/filesystem/functions/fnmatch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.fnmatch"> <refnamediv> <refname>fnmatch</refname> <refpurpose>Match filename against a pattern</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>fnmatch</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> </methodsynopsis> <para> <function>fnmatch</function> checks if the passed <parameter>string</parameter> would match the given shell wildcard <parameter>pattern</parameter>. </para> <para> This is especialy usefull for filenames, but may also be used on regular strings. The average user may be used to shell patterns or at least in their simplest form to <literal>'?'</literal> and <literal>'*'</literal> wildcards so using <function>fnmatch</function> instead of <function>ereg</function> or <function>preg_match</function> for frontend search expression input may be way more convenient for non-programming users. </para> <example> <title> Checking a color name against a shell wildcard pattern. </title> <programlisting role="php"> <![CDATA[ if(fnmatch("*gr[ae]y", $color)) { echo "some form of gray ..."; } ]]> </programlisting> </example> <para> See also <function>glob</function>, <function>ereg</function>, <function>preg_match</function> and the unix manpage on <literal>fnmatch(3)</literal> for flag names (as long as they are not documented here <!-- TODO hartmut -->). </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fopen.xml +++ phpdoc-zh/reference/filesystem/functions/fopen.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fopen"> <refnamediv> <refname>fopen</refname> <refpurpose>Opens file or URL</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fopen</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam><type>string</type><parameter>mode</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam> <methodparam choice="opt"><type>resource</type><parameter>zcontext</parameter></methodparam> </methodsynopsis> <simpara> <function>fopen</function> binds a named resource, specified by <parameter>filename</parameter>, to a stream. If <parameter>filename</parameter> is of the form "scheme://...", it is assumed to be a URL and PHP will search for a protocol handler (also known as a wrapper) for that scheme. If no wrappers for that protocol are registered, PHP will emit a notice to help you track potential problems in your script and then continue as though <parameter>filename</parameter> specifies a regular file. </simpara> <simpara> If PHP has decided that <parameter>filename</parameter> specifies a local file, then it will try to open a stream on that file. The file must be accessible to PHP, so you need to ensure that the file access permissions allow this access. If you have enabled <link linkend="ini.safe-mode">safe_mode</link>, or <link linkend="ini.open-basedir">open_basedir</link> further restrictions may apply. </simpara> <simpara> If PHP has decided that <parameter>filename</parameter> specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that <link linkend="ini.allow-url-fopen">allow_url_fopen</link> is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail. </simpara> <note> <simpara> The list of supported protocols can be found in <xref linkend="wrappers"/>. </simpara> </note> <para> <parameter>mode</parameter> specifies the type of access you require to the stream. It may be any of the following: <itemizedlist> <listitem> <simpara> 'r' - Open for reading only; place the file pointer at the beginning of the file. </simpara> </listitem> <listitem> <simpara> 'r+' - Open for reading and writing; place the file pointer at the beginning of the file. </simpara> </listitem> <listitem> <simpara> 'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. </simpara> </listitem> <listitem> <simpara> 'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. </simpara> </listitem> <listitem> <simpara> 'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. </simpara> </listitem> <listitem> <simpara> 'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. </simpara> </listitem> </itemizedlist> </para> <note> <para> The <parameter>mode</parameter> may contain the letter 'b'. This is useful only on systems which differentiate between binary and text files (i.e. Windows. It's useless on Unix). If not needed, this will be ignored. You are encouraged to include the 'b' flag in order to make your scripts more portable. </para> </note> <para> The optional third <parameter>use_include_path</parameter> parameter can be set to '1' or &true; if you want to search for the file in the <link linkend="ini.include-path">include_path</link>, too. </para> <para> The optional fourth <parameter>zcontext</parameter> is used for specifying tuning parameters and callbacks. </para> <simpara> If the open fails, the function returns &false;. </simpara> <para> <example> <title><function>fopen</function> example</title> <programlisting role="php"> <![CDATA[ <?php $fp = fopen ("/home/rasmus/file.txt", "r"); $fp = fopen ("/home/rasmus/file.gif", "wb"); $fp = fopen ("http://www.example.com/", "r"); $fp = fopen ("ftp://user:password@example.com/", "w"); ?> ]]> </programlisting> </example> </para> <simpara> If you are experiencing problems with reading and writing to files and you're using the server module version of PHP, remember to make sure that the files and directories you're using are accessible to the server process. </simpara> <para> On the Windows platform, be careful to escape any backslashes used in the path to the file, or use forward slashes. <informalexample> <programlisting role="php"> <![CDATA[ <?php $fp = fopen ("c:\\data\\info.txt", "r"); ?> ]]> </programlisting> </informalexample> </para> <simpara> See also <xref linkend="wrappers"/>, <function>fclose</function>, <function>fgets</function>, <function>fsockopen</function>, <function>file</function>, <function>file_exists</function>, <function>is_readable</function>, <function>socket_set_timeout</function>, and <function>popen</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fpassthru.xml +++ phpdoc-zh/reference/filesystem/functions/fpassthru.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fpassthru"> <refnamediv> <refname>fpassthru</refname> <refpurpose>Output all remaining data on a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fpassthru</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <simpara> Reads to EOF on the given file pointer from the current position and writes the results to the output buffer. </simpara> <simpara> If an error occurs, <function>fpassthru</function> returns &false;. </simpara> <simpara> The file pointer must be valid, and must point to a file successfully opened by <function>fopen</function>, <function>popen</function>, or <function>fsockopen</function>. You may need to call <function>rewind</function> to reset the file pointer to the beginning of the file if you have already written data to the file. The file is closed when <function>fpassthru</function> is done reading it (leaving <parameter>fp</parameter> useless). </simpara> <simpara> If you just want to dump the contents of a file to the output buffer, without first modifying it or seeking to a particular offset, you may want to use the <function>readfile</function>, which saves you the <function>fopen</function> call. </simpara> <note> <para> When using <function>fpassthru</function> on a binary file on Windows systems, you should make sure to open the file in binary mode by appending a <literal>b</literal> to the mode used in the call to <function>fopen</function>. </para> <para> You are encouraged to use the <literal>b</literal> flag when dealing with binary files, even if your system does not require it, so that your scripts will be more portable. </para> </note> <simpara> See also <function>readfile</function>, <function>fopen</function>, <function>popen</function>, and <function>fsockopen</function> </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fputs.xml +++ phpdoc-zh/reference/filesystem/functions/fputs.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fputs"> <refnamediv> <refname>fputs</refname> <refpurpose>Writes to a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fputs</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>string</type><parameter>str</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> </methodsynopsis> <para> <function>fputs</function> is an alias to <function>fwrite</function>, and is identical in every way. Note that the <parameter>length</parameter> parameter is optional and if not specified the entire string will be written. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fread.xml +++ phpdoc-zh/reference/filesystem/functions/fread.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.25 --> <refentry id="function.fread"> <refnamediv> <refname>fread</refname> <refpurpose>Binary-safe file read</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>fread</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>length</parameter></methodparam> </methodsynopsis> <simpara> <function>fread</function> reads up to <parameter>length</parameter> bytes from the file pointer referenced by <parameter>fp</parameter>. Reading stops when <parameter>length</parameter> bytes have been read or EOF is reached, whichever comes first. </simpara> <para> <informalexample> <programlisting role="php"> <![CDATA[ // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); ]]> </programlisting> </informalexample> </para> <note> <para> On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in <function>fopen</function> mode parameter. </para> </note> <para> <informalexample> <programlisting role="php"> <![CDATA[ $filename = "c:\\files\\somepic.gif"; $fd = fopen ($filename, "rb"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); ]]> </programlisting> </informalexample> </para> <simpara> See also <function>fwrite</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, <function>fgets</function>, <function>fgetss</function>, <function>fscanf</function>, <function>file</function>, and <function>fpassthru</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fscanf.xml +++ phpdoc-zh/reference/filesystem/functions/fscanf.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fscanf"> <refnamediv> <refname>fscanf</refname> <refpurpose>Parses input from a file according to a format</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>mixed</type><methodname>fscanf</methodname> <methodparam><type>int</type><parameter>handle</parameter></methodparam> <methodparam><type>string</type><parameter>format</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>var1</parameter></methodparam> </methodsynopsis> <para> The function <function>fscanf</function> is similar to <function>sscanf</function>, but it takes its input from a file associated with <parameter>handle</parameter> and interprets the input according to the specified <parameter>format</parameter>. If only two parameters were passed to this function, the values parsed will be returned as an array. Otherwise, if optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference. </para> <para> Any whitespace in the format string matches any whitespace in the input stream. This means that even a tab <literal>\t</literal> in the format string can match a single space character in the input stream. </para> <para> <example> <title><function>fscanf</function> Example</title> <programlisting role="php"> <![CDATA[ $fp = fopen ("users.txt","r"); while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) { list ($name, $profession, $countrycode) = $userinfo; //... do something with the values } fclose($fp); ]]> </programlisting> </example> <example> <title>users.txt</title> <programlisting> <![CDATA[ javier argonaut pe hiroshi sculptor jp robert slacker us luigi florist it ]]> </programlisting> </example> </para> <para> See also <function>fread</function>, <function>fgets</function>, <function>fgetss</function>, <function>sscanf</function>, <function>printf</function>, and <function>sprintf</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fseek.xml +++ phpdoc-zh/reference/filesystem/functions/fseek.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fseek"> <refnamediv> <refname>fseek</refname> <refpurpose>Seeks on a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fseek</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>offset</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>whence</parameter></methodparam> </methodsynopsis> <para> Sets the file position indicator for the file referenced by <parameter>fp</parameter>.The new position, measured in bytes from the beginning of the file, is obtained by adding <parameter>offset</parameter> to the position specified by <parameter>whence</parameter>, whose values are defined as follows: <simplelist> <member>SEEK_SET - Set position equal to <parameter>offset</parameter> bytes.</member> <member>SEEK_CUR - Set position to current location plus <parameter>offset</parameter>.</member> <member>SEEK_END - Set position to end-of-file plus <parameter>offset</parameter>. (To move to a position before the end-of-file, you need to pass a negative value in <parameter>offset</parameter>.)</member> </simplelist> </para> <para>If <parameter>whence</parameter> is not specified, it is assumed to be SEEK_SET. </para> <para> Upon success, returns 0; otherwise, returns -1. Note that seeking past EOF is not considered an error. </para> <para> May not be used on file pointers returned by <function>fopen</function> if they use the "http://" or "ftp://" formats. </para> <note> <para> The <parameter>whence</parameter> argument was added after PHP 4.0.0. </para> </note> <para> See also <function>ftell</function> and <function>rewind</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fstat.xml +++ phpdoc-zh/reference/filesystem/functions/fstat.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.24 --> <refentry id="function.fstat"> <refnamediv> <refname>fstat</refname> <refpurpose>Gets information about a file using an open file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>fstat</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Gathers the statistics of the file opened by the file pointer fp. This function is similar to the <function>stat</function> function except that it operates on an open file pointer instead of a filename. </para> <para> Returns an array with the statistics of the file with the following elements: <orderedlist> <listitem><simpara>device</simpara></listitem> <listitem><simpara>inode</simpara></listitem> <listitem><simpara>number of links</simpara></listitem> <listitem><simpara>user id of owner</simpara></listitem> <listitem><simpara>group id owner</simpara></listitem> <listitem><simpara>device type if inode device *</simpara></listitem> <listitem><simpara>size in bytes</simpara></listitem> <listitem><simpara>time of last access</simpara></listitem> <listitem><simpara>time of last modification</simpara></listitem> <listitem><simpara>time of last change</simpara></listitem> <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem> <listitem><simpara>number of blocks allocated</simpara></listitem> </orderedlist> * - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1 </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/ftell.xml +++ phpdoc-zh/reference/filesystem/functions/ftell.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.ftell"> <refnamediv> <refname>ftell</refname> <refpurpose>Tells file pointer read/write position</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>ftell</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Returns the position of the file pointer referenced by fp; i.e., its offset into the file stream. </para> <para> If an error occurs, returns &false;. </para> <para> The file pointer must be valid, and must point to a file successfully opened by <function>fopen</function> or <function>popen</function>. </para> <para> See also <function>fopen</function>, <function>popen</function>, <function>fseek</function>, and <function>rewind</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/ftruncate.xml +++ phpdoc-zh/reference/filesystem/functions/ftruncate.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.14 --> <refentry id="function.ftruncate"> <refnamediv> <refname>ftruncate</refname> <refpurpose>Truncates a file to a given length</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>ftruncate</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>int</type><parameter>size</parameter></methodparam> </methodsynopsis> <para> Takes the filepointer, <parameter>fp</parameter>, and truncates the file to length, <parameter>size</parameter>. This function returns &true; on success and &false; on failure. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/fwrite.xml +++ phpdoc-zh/reference/filesystem/functions/fwrite.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.fwrite"> <refnamediv> <refname>fwrite</refname> <refpurpose>Binary-safe file write</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>fwrite</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> </methodsynopsis> <simpara> <function>fwrite</function> writes the contents of <parameter>string</parameter> to the file stream pointed to by <parameter>fp</parameter>. If the <parameter>length</parameter> argument is given, writing will stop after <parameter>length</parameter> bytes have been written or the end of <parameter>string</parameter> is reached, whichever comes first. </simpara> <simpara> <function>fwrite</function> returns the number of bytes written, or -1 on error. </simpara> <simpara> Note that if the <parameter>length</parameter> argument is given, then the <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link> configuration option will be ignored and no slashes will be stripped from <parameter>string</parameter>. </simpara> <note> <para> On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in <function>fopen</function> mode parameter. </para> </note> <simpara> See also <function>fread</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, and <function>fputs</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/glob.xml +++ phpdoc-zh/reference/filesystem/functions/glob.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.glob"> <refnamediv> <refname>glob</refname> <refpurpose>Find pathnames matching a pattern</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>glob</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam> </methodsynopsis> <para> The <function>glob</function> function searches for all the pathnames matching <parameter>pattern</parameter> according to the rules used by the shell. No tilde expansion or parameter substitution is done. </para> <para> Returns an array containing the matched files/directories or &false; on error. </para> <example> <title> Convenient way how <function>glob</function> can replace <function>opendir</function> and friends. </title> <programlisting role="php"> <![CDATA[ foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ]]> </programlisting> <para> This could result in the following output: </para> <screen> funclist.txt size 44686 funcsummary.txt size 267625 quickref.txt size 137820 </screen> </example> <para> See also <function>opendir</function>, <function>readdir</function> and <function>closedir</function>, <function>fnmatch</function> and the unix manpage on <literal>glob(3)</literal> for flag names (as long as they are not documented here <!-- TODO hartmut -->). </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-dir.xml +++ phpdoc-zh/reference/filesystem/functions/is-dir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-dir"> <refnamediv> <refname>is_dir</refname> <refpurpose>Tells whether the filename is a directory</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_dir</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is a directory. If <parameter>filename</parameter> is a relative filename, it will be checked relative to the current working directory. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>chdir</function>, <link linkend="class.dir">dir</link>, <function>opendir</function>, <function>is_file</function> and <function>is_link</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-executable.xml +++ phpdoc-zh/reference/filesystem/functions/is-executable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-executable"> <refnamediv> <refname>is_executable</refname> <refpurpose>Tells whether the filename is executable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_executable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is executable. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_file</function> and <function>is_link</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-file.xml +++ phpdoc-zh/reference/filesystem/functions/is-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-file"> <refnamediv> <refname>is_file</refname> <refpurpose>Tells whether the filename is a regular file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is a regular file. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_dir</function> and <function>is_link</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-link.xml +++ phpdoc-zh/reference/filesystem/functions/is-link.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-link"> <refnamediv> <refname>is_link</refname> <refpurpose>Tells whether the filename is a symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_link</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is a symbolic link. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <para> See also <function>is_dir</function>, <function>is_file</function>, and <function>readlink</function>. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-readable.xml +++ phpdoc-zh/reference/filesystem/functions/is-readable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-readable"> <refnamediv> <refname>is_readable</refname> <refpurpose>Tells whether the filename is readable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_readable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is readable. </para> <para> Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_writable</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-uploaded-file.xml +++ phpdoc-zh/reference/filesystem/functions/is-uploaded-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.39 --> <refentry id="function.is-uploaded-file"> <refnamediv> <refname>is_uploaded_file</refname> <refpurpose>Tells whether the file was uploaded via HTTP POST</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_uploaded_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the file named by <varname>filename</varname> was uploaded via HTTP POST. This is useful to help ensure that a malicious user hasn't tried to trick the script into working on files upon which it should not be working--for instance, <filename>/etc/passwd</filename>. </para> <para> This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system. </para> <para> <function>is_uploaded_file</function> is available only in versions of PHP 3 after PHP 3.0.16, and in versions of PHP 4 after 4.0.2. If you are stuck using an earlier version, you can use the following function to help protect yourself: <note> <para> The following example will <emphasis>not</emphasis> work in versions of PHP 4 after 4.0.2. It depends on internal functionality of PHP which changed after that version. </para> </note> <programlisting role="php"> <![CDATA[ <?php /* Userland test for uploaded file. */ function is_uploaded_file($filename) { if (!$tmp_file = get_cfg_var('upload_tmp_dir')) { $tmp_file = dirname(tempnam('', '')); } $tmp_file .= '/' . basename($filename); /* User might have trailing slash in php.ini... */ return (ereg_replace('/+', '/', $tmp_file) == $filename); } /* This is how to use it, since you also don't have * move_uploaded_file() in these older versions: */ if (is_uploaded_file($HTTP_POST_FILES['userfile'])) { copy($HTTP_POST_FILES['userfile'], "/place/to/put/uploaded/file"); } else { echo "Possible file upload attack: filename '$HTTP_POST_FILES[userfile]'."; } ?> ]]> </programlisting> </para> <para> See also <function>move_uploaded_file</function>, and the section <link linkend="features.file-upload">Handling file uploads</link> for a simple usage example. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-writable.xml +++ phpdoc-zh/reference/filesystem/functions/is-writable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.is-writable"> <refnamediv> <refname>is_writable</refname> <refpurpose>Tells whether the filename is writable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_writable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Returns &true; if the filename exists and is writable. The filename argument may be a directory name allowing you to check if a directory is writeable. </para> <para> Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> <simpara> This function will not work on <link linkend="features.remote-files">remote files</link>; the file to be examined must be accessible via the server's filesystem. </simpara> <para> See also <function>is_readable</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/is-writeable.xml +++ phpdoc-zh/reference/filesystem/functions/is-writeable.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.55 --> <refentry id="function.is-writeable"> <refnamediv> <refname>is_writeable</refname> <refpurpose>Tells whether the filename is writable</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>is_writeable</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> This is an alias for <function>is_writable</function> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/link.xml +++ phpdoc-zh/reference/filesystem/functions/link.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.link"> <refnamediv> <refname>link</refname> <refpurpose>Create a hard link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>link</methodname> <methodparam><type>string</type><parameter>target</parameter></methodparam> <methodparam><type>string</type><parameter>link</parameter></methodparam> </methodsynopsis> <para> <function>link</function> creates a hard link.</para> <para> See also the <function>symlink</function> to create soft links, and <function>readlink</function> along with <function>linkinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/linkinfo.xml +++ phpdoc-zh/reference/filesystem/functions/linkinfo.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.linkinfo"> <refnamediv> <refname>linkinfo</refname> <refpurpose>Gets information about a link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>linkinfo</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>linkinfo</function> returns the st_dev field of the UNIX C stat structure returned by the lstat system call. This function is used to verify if a link (pointed to by <parameter>path</parameter>) really exists (using the same method as the S_ISLNK macro defined in stat.h). Returns 0 or &false; in case of error. </para> <para> See also <function>symlink</function>, <function>link</function>, and <function>readlink</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/lstat.xml +++ phpdoc-zh/reference/filesystem/functions/lstat.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.lstat"> <refnamediv> <refname>lstat</refname> <refpurpose>Gives information about a file or symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>lstat</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Gathers the statistics of the file or symbolic link named by filename. This function is identical to the <function>stat</function> function except that if the <parameter>filename</parameter> parameter is a symbolic link, the status of the symbolic link is returned, not the status of the file pointed to by the symbolic link. </para> <para> Returns an array with the statistics of the file with the following elements: <orderedlist> <listitem><simpara>device</simpara></listitem> <listitem><simpara>inode</simpara></listitem> <listitem><simpara>inode protection mode</simpara></listitem> <listitem><simpara>number of links</simpara></listitem> <listitem><simpara>user id of owner</simpara></listitem> <listitem><simpara>group id owner</simpara></listitem> <listitem><simpara>device type if inode device *</simpara></listitem> <listitem><simpara>size in bytes</simpara></listitem> <listitem><simpara>time of last access</simpara></listitem> <listitem><simpara>time of last modification</simpara></listitem> <listitem><simpara>time of last change</simpara></listitem> <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem> <listitem><simpara>number of blocks allocated</simpara></listitem> </orderedlist> * - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1. </para> <para> <function>lstat</function> cannot be used on <link linkend="features.remote-files">remote files</link>. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/mkdir.xml +++ phpdoc-zh/reference/filesystem/functions/mkdir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.39 --> <refentry id="function.mkdir"> <refnamediv> <refname>mkdir</refname> <refpurpose>Makes directory</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>mkdir</methodname> <methodparam><type>string</type><parameter>pathname</parameter></methodparam> <methodparam><type>int</type><parameter>mode</parameter></methodparam> </methodsynopsis> <para> Attempts to create the directory specified by pathname. </para> <para> Note that you probably want to specify the mode as an octal number, which means it should have a leading zero. The mode is also modified by the current umask, which you can change using <function>umask</function>. <informalexample> <programlisting role="php"> <![CDATA[ mkdir ("/path/to/my/dir", 0700); ]]> </programlisting> </informalexample> </para> <para> &return.success; </para> <para> See also <function>rmdir</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/move-uploaded-file.xml +++ phpdoc-zh/reference/filesystem/functions/move-uploaded-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.move-uploaded-file"> <refnamediv> <refname>move_uploaded_file</refname> <refpurpose>Moves an uploaded file to a new location</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>move_uploaded_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam><type>string</type><parameter>destination</parameter></methodparam> </methodsynopsis> <para> This function checks to ensure that the file designated by <parameter>filename</parameter> is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by <parameter>destination</parameter>. </para> <para> If <parameter>filename</parameter> is not a valid upload file, then no action will occur, and <function>move_uploaded_file</function> will return &false;. </para> <para> If <parameter>filename</parameter> is a valid upload file, but cannot be moved for some reason, no action will occur, and <function>move_uploaded_file</function> will return &false;. Additionally, a warning will be issued. </para> <para> This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system. </para> ¬e.sm.uidcheck; <note> <para> <function>move_uploaded_file</function> is not affected by the normal safe-mode UID-restrictions. This is not unsafe because <function>move_uploaded_file</function> only operates on files uploaded via PHP. </para> </note> <warning> <para> If the destination file already exists, it will be overwritten. </para> </warning> <para> See also <function>is_uploaded_file</function>, and the section <link linkend="features.file-upload">Handling file uploads</link> for a simple usage example. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/parse-ini-file.xml +++ phpdoc-zh/reference/filesystem/functions/parse-ini-file.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.87 --> <refentry id="function.parse-ini-file"> <refnamediv> <refname>parse_ini_file</refname> <refpurpose>Parse a configuration file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>parse_ini_file</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>process_sections</parameter></methodparam> </methodsynopsis> <para> <function>parse_ini_file</function> loads in the ini file specified in <parameter>filename</parameter>, and returns the settings in it in an associative array. By setting the last <parameter>process_sections</parameter> parameter to &true;, you get a multidimensional array, with the section names and settings included. The default for <parameter>process_sections</parameter> is &false; </para> <note> <para> This function has nothing to do with the &php.ini; file. It is already processed, the time you run your script. This function can be used to read in your own application's configuration files. </para> </note> <note> <para> If a value in the ini file contains any non-alphanumeric characters it needs to be enclosed in double-quotes ("). </para> </note> <note> <simpara> Since PHP 4.2.1 this function is also affected by <link linkend="ini.safe-mode">safe_mode</link> and <link linkend="ini.open-basedir">open_basedir</link>. </simpara> </note> <para> The structure of the ini file is similar to that of the &php.ini;'s. </para> <warning> <para> If the ini file you are trying to parse is malformed, PHP will exit. </para> </warning> <para> <example> <title>Contents of sample.ini</title> <programlisting> <![CDATA[ ; This is a sample configuration file ; Comments start with ';', as in php.ini [first_section] one = 1 five = 5 [second_section] path = /usr/local/bin URL = "http://www.example.com/~username" ]]> </programlisting> </example> </para> <para> <example> <title><function>parse_ini_file</function> example</title> <programlisting> <![CDATA[ <?php // Parse without sections $ini_array = parse_ini_file("sample.ini"); print_r($ini_array); // Parse with sections $ini_array = parse_ini_file("sample.ini", TRUE); print_r($ini_array); ?> ]]> </programlisting> </example> </para> <para> Would produce: <informalexample> <programlisting> <![CDATA[ Array ( [one] => 1 [five] => 5 [path] => /usr/local/bin [URL] => http://www.example.com/~username ) Array ( [first_section] => Array ( [one] => 1 [five] => 5 ) [second_section] => Array ( [path] => /usr/local/bin [URL] => http://www.example.com/~username ) ) ]]> </programlisting> </informalexample> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/pathinfo.xml +++ phpdoc-zh/reference/filesystem/functions/pathinfo.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.61 --> <refentry id="function.pathinfo"> <refnamediv> <refname>pathinfo</refname> <refpurpose>Returns information about a file path</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>pathinfo</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>pathinfo</function> returns an associative array containing information about <parameter>path</parameter>. The following array elements are returned: <parameter>dirname</parameter>, <parameter>basename</parameter> and <parameter>extension</parameter>. </para> <para> <example> <title><function>pathinfo</function> Example</title> <programlisting role="php"> <![CDATA[ <?php $path_parts = pathinfo("/www/htdocs/index.html"); echo $path_parts["dirname"] . "\n"; echo $path_parts["basename"] . "\n"; echo $path_parts["extension"] . "\n"; ?> ]]> </programlisting> </example> </para> <para> Would produce: <informalexample> <programlisting> <![CDATA[ /www/htdocs index.html html ]]> </programlisting> </informalexample> </para> <para> See also <function>dirname</function>, <function>basename</function>, <function>parse_url</function> and <function>realpath</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/pclose.xml +++ phpdoc-zh/reference/filesystem/functions/pclose.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.pclose"> <refnamediv> <refname>pclose</refname> <refpurpose>Closes process file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>pclose</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Closes a file pointer to a pipe opened by <function>popen</function>. </para> <para> The file pointer must be valid, and must have been returned by a successful call to <function>popen</function>. </para> <para> Returns the termination status of the process that was run. </para> <para> See also <function>popen</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/popen.xml +++ phpdoc-zh/reference/filesystem/functions/popen.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.popen"> <refnamediv> <refname>popen</refname> <refpurpose>Opens process file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>popen</methodname> <methodparam><type>string</type><parameter>command</parameter></methodparam> <methodparam><type>string</type><parameter>mode</parameter></methodparam> </methodsynopsis> <para> Opens a pipe to a process executed by forking the command given by command. </para> <para> Returns a file pointer identical to that returned by <function>fopen</function>, except that it is unidirectional (may only be used for reading or writing) and must be closed with <function>pclose</function>. This pointer may be used with <function>fgets</function>, <function>fgetss</function>, and <function>fputs</function>. </para> <para> If an error occurs, returns &false;. </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ $fp = popen ("/bin/ls", "r"); ]]> </programlisting> </informalexample> </para> <note> <para> If the command to be executed could not be found, a valid resource is returned. This may seem odd, but makes sense; it allows you to access any error message returned by the shell: <informalexample> <programlisting role="php"> <![CDATA[ <?php error_reporting(E_ALL); /* Add redirection so we can get stderr. */ $fp = popen('/path/to/spooge 2>&1', 'r'); echo "'$fp'; " . gettype($fp) . "\n"; $read = fread($fp, 2096); echo $read; pclose($fp); ?> ]]> </programlisting> </informalexample> </para> </note> <para> See also <function>pclose</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/readfile.xml +++ phpdoc-zh/reference/filesystem/functions/readfile.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.readfile"> <refnamediv> <refname>readfile</refname> <refpurpose>Outputs a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>readfile</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>use_include_path</parameter></methodparam> </methodsynopsis> <para> Reads a file and writes it to the output buffer. </para> <para> Returns the number of bytes read from the file. If an error occurs, &false; is returned and unless the function was called as @readfile, an error message is printed. </para> &tip.fopen-wrapper; <para> You can use the optional second parameter and set it to "1", if you want to search for the file in the <link linkend="ini.include-path">include_path</link>, too. </para> <para> See also <function>fpassthru</function>, <function>file</function>, <function>fopen</function>, <function>include</function>, <function>require</function>, <function>virtual</function> and <xref linkend="wrappers"/>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/readlink.xml +++ phpdoc-zh/reference/filesystem/functions/readlink.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.readlink"> <refnamediv> <refname>readlink</refname> <refpurpose>Returns the target of a symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>readlink</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>readlink</function> does the same as the readlink C function and returns the contents of the symbolic link path or 0 in case of error. </para> <para> See also <function>is_link</function>, <function>symlink</function>, and <function>linkinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/realpath.xml +++ phpdoc-zh/reference/filesystem/functions/realpath.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.23 --> <refentry id="function.realpath"> <refnamediv> <refname>realpath</refname> <refpurpose>Returns canonicalized absolute pathname</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>realpath</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> <function>realpath</function> expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the input <parameter>path</parameter> and return the canonicalized absolute pathname. The resulting path will have no symbolic link, '/./' or '/../' components. </para> <para> <function>realpath</function> returns &false; on failure, e.g. if the file does not exists. </para> <para> <example> <title><function>realpath</function> example</title> <programlisting role="php"> <![CDATA[ $real_path = realpath ("../../index.php"); ]]> </programlisting> </example> </para> <para> See also: <function>basename</function>, <function>dirname</function>, and <function>pathinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/rename.xml +++ phpdoc-zh/reference/filesystem/functions/rename.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.rename"> <refnamediv> <refname>rename</refname> <refpurpose>Renames a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>rename</methodname> <methodparam><type>string</type><parameter>oldname</parameter></methodparam> <methodparam><type>string</type><parameter>newname</parameter></methodparam> </methodsynopsis> <para> Attempts to rename <parameter>oldname</parameter> to <parameter>newname</parameter>. </para> <para> &return.success; <example> <title>Example with <function>rename</function></title> <programlisting role="php"> <![CDATA[ <?php rename("/tmp/tmp_file.txt", "/home/user/login/docs/my_file.txt"); ?> ]]> </programlisting> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/rewind.xml +++ phpdoc-zh/reference/filesystem/functions/rewind.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.rewind"> <refnamediv> <refname>rewind</refname> <refpurpose>Rewind the position of a file pointer</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>rewind</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> </methodsynopsis> <para> Sets the file position indicator for fp to the beginning of the file stream. </para> <para> If an error occurs, returns 0, otherwise it returns 1. </para> <para> The file pointer must be valid, and must point to a file successfully opened by <function>fopen</function>. </para> <note> <para> If you have opened the file in append ("a") mode, any data you write to the file will always be appended, regardless of the file position. </para> </note> <para> See also <function>fseek</function> and <function>ftell</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/rmdir.xml +++ phpdoc-zh/reference/filesystem/functions/rmdir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.rmdir"> <refnamediv> <refname>rmdir</refname> <refpurpose>Removes directory</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>rmdir</methodname> <methodparam><type>string</type><parameter>dirname</parameter></methodparam> </methodsynopsis> <para> Attempts to remove the directory named by <parameter>dirname</parameter>. The directory must be empty, and the relevant permissions must permit this. &return.success; </para> <para> See also <function>mkdir</function> and <function>unlink</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/set-file-buffer.xml +++ phpdoc-zh/reference/filesystem/functions/set-file-buffer.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.set-file-buffer"> <refnamediv> <refname>set_file_buffer</refname> <refpurpose>Alias of <function>stream_set_write_buffer</function></refpurpose> </refnamediv> <refsect1> <title>Description</title> <simpara> This function is an alias of <function>stream_set_write_buffer</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stat.xml +++ phpdoc-zh/reference/filesystem/functions/stat.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.stat"> <refnamediv> <refname>stat</refname> <refpurpose>Gives information about a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>stat</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Gathers the statistics of the file named by filename. </para> <para> Returns an array with the statistics of the file with the following elements: <orderedlist> <listitem><simpara>device</simpara></listitem> <listitem><simpara>inode</simpara></listitem> <listitem><simpara>inode protection mode</simpara></listitem> <listitem><simpara>number of links</simpara></listitem> <listitem><simpara>user id of owner</simpara></listitem> <listitem><simpara>group id owner</simpara></listitem> <listitem><simpara>device type if inode device *</simpara></listitem> <listitem><simpara>size in bytes</simpara></listitem> <listitem><simpara>time of last access</simpara></listitem> <listitem><simpara>time of last modification</simpara></listitem> <listitem><simpara>time of last change</simpara></listitem> <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem> <listitem><simpara>number of blocks allocated</simpara></listitem> </orderedlist> * - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1. </para> <para> Returns &false; in case of error. </para> <para> <function>stat</function> cannot be used on <link linkend="features.remote-files">remote files</link>. </para> <para> The results of this function are cached. See <function>clearstatcache</function> for more details. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stream-set-blocking.xml +++ phpdoc-zh/reference/filesystem/functions/stream-set-blocking.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/network.xml, last change in rev 1.2 --> <refentry id="function.stream-set-blocking"> <refnamediv> <refname>stream_set_blocking</refname> <refpurpose>Set blocking/non-blocking mode on a stream</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>stream_set_blocking</methodname> <methodparam><type>resource</type><parameter>stream</parameter></methodparam> <methodparam><type>int</type><parameter>mode</parameter></methodparam> </methodsynopsis> <para> If <parameter>mode</parameter> is &false;, the given stream will be switched to non-blocking mode, and if &true;, it will be switched to blocking mode. This affects calls like <function>fgets</function> and <function>fread</function> that read from the stream. In non-blocking mode an <function>fgets</function> call will always return right away while in blocking mode it will wait for data to become available on the stream. </para> <para> This function was previously called as <function>set_socket_blocking</function> and later <function>socket_set_blocking</function> but this usage is deprecated. </para> <note> <simpara> Prior to PHP 4.3, this function only worked on socket based streams. Since PHP 4.3, this function works for any stream that supports non-blocking mode (currently, regular files and socket streams). </simpara> </note> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stream-set-timeout.xml +++ phpdoc-zh/reference/filesystem/functions/stream-set-timeout.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/network.xml, last change in rev 1.18 --> <refentry id="function.stream-set-timeout"> <refnamediv> <refname>stream_set_timeout</refname> <refpurpose>Set timeout period on a stream</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>stream_set_timeout</methodname> <methodparam><type>resource</type><parameter>stream</parameter></methodparam> <methodparam><type>int</type><parameter>seconds</parameter></methodparam> <methodparam><type>int</type><parameter>microseconds</parameter></methodparam> </methodsynopsis> <para> Sets the timeout value on <parameter>stream</parameter>, expressed in the sum of <parameter>seconds</parameter> and <parameter>microseconds</parameter>. <example> <title><function>stream_set_timeout</function> Example</title> <programlisting role="php"> <![CDATA[ <?php $fp = fsockopen("www.example.com", 80); if(!$fp) { echo "Unable to open\n"; } else { fputs($fp, "GET / HTTP/1.0\n\n"); $start = time(); socket_set_timeout($fp, 2); $res = fread($fp, 2000); var_dump(stream_get_meta_data($fp)); fclose($fp); print $res; } ?> ]]> </programlisting> </example> </para> <note> <simpara> As of PHP 4.3, this function can (potentially) work on any kind of stream. In PHP 4.3, socket based streams are still the only kind supported in the PHP core, although streams from other extensions may support this function. </simpara> </note> <para> This function was previously called as <function>set_socket_timeout</function> and later <function>socket_set_timeout</function> but this usage is deprecated. </para> <para> See also: <function>fsockopen</function> and <function>fopen</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/stream-set-write-buffer.xml +++ phpdoc-zh/reference/filesystem/functions/stream-set-write-buffer.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.stream-set-write-buffer"> <refnamediv> <refname>stream_set_write_buffer</refname> <refpurpose>Sets file buffering on the given stream</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>stream_set_write_buffer</methodname> <methodparam><type>resource</type><parameter>stream</parameter></methodparam> <methodparam><type>int</type><parameter>buffer</parameter></methodparam> </methodsynopsis> <simpara> Output using <function>fwrite</function> is normally buffered at 8K. This means that if there are two processes wanting to write to the same output stream (a file), each is paused after 8K of data to allow the other to write. <function>stream_set_write_buffer</function> sets the buffering for write operations on the given filepointer <parameter>stream</parameter> to <parameter>buffer</parameter> bytes. If <parameter>buffer</parameter> is 0 then write operations are unbuffered. This ensures that all writes with <function>fwrite</function> are completed before other processes are allowed to write to that output stream. </simpara> <simpara> The function returns 0 on success, or EOF if the request cannot be honored. </simpara> <para> The following example demonstrates how to use <function>stream_set_write_buffer</function> to create an unbuffered stream. <example> <title><function>stream_set_write_buffer</function> example</title> <programlisting role="php"> <![CDATA[ $fp = fopen($file, "w"); if ($fp) { stream_set_write_buffer($fp, 0); fputs($fp, $output); fclose($fp); } ]]> </programlisting> </example> </para> <simpara> See also <function>fopen</function> and <function>fwrite</function>. </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/symlink.xml +++ phpdoc-zh/reference/filesystem/functions/symlink.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.symlink"> <refnamediv> <refname>symlink</refname> <refpurpose>Creates a symbolic link</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>symlink</methodname> <methodparam><type>string</type><parameter>target</parameter></methodparam> <methodparam><type>string</type><parameter>link</parameter></methodparam> </methodsynopsis> <para> <function>symlink</function> creates a symbolic link from the existing <parameter>target</parameter> with the specified name <parameter>link</parameter>. </para> <para> See also <function>link</function> to create hard links, and <function>readlink</function> along with <function>linkinfo</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/tempnam.xml +++ phpdoc-zh/reference/filesystem/functions/tempnam.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.tempnam"> <refnamediv> <refname>tempnam</refname> <refpurpose>Create file with unique file name</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>tempnam</methodname> <methodparam><type>string</type><parameter>dir</parameter></methodparam> <methodparam><type>string</type><parameter>prefix</parameter></methodparam> </methodsynopsis> <para> Creates a file with a unique filename in the specified directory. If the directory does not exist, <function>tempnam</function> may generate a file in the system's temporary directory, and return the name of that. </para> <para> Prior to PHP 4.0.6, the behaviour of the <function>tempnam</function> function was system dependent. On Windows the TMP environment variable will override the <parameter>dir</parameter> parameter, on Linux the TMPDIR environment variable has precedence, while SVR4 will always use your <parameter>dir</parameter> parameter if the directory it points to exists. Consult your system documentation on the tempnam(3) function if in doubt. </para> <para> Returns the new temporary filename, or the &false; string on failure. <example> <title><function>tempnam</function> example</title> <programlisting role="php"> <![CDATA[ $tmpfname = tempnam ("/tmp", "FOO"); $fp = fopen($tmpfname, "w"); fwrite($fp, "writing to tempfile"); fclose($fp); // do here something unlink($tmpfname); ]]> </programlisting> </example> </para> <note> <simpara> This function's behavior changed in 4.0.3. The temporary file is also created to avoid a race condition where the file might appear in the filesystem between the time the string was generated and before the the script gets around to creating the file. Note, that you need to remove the file in case you need it no more, it is not done automatically. </simpara> </note> <para> See also <function>tmpfile</function> and <function>unlink</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/tmpfile.xml +++ phpdoc-zh/reference/filesystem/functions/tmpfile.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.32 --> <refentry id="function.tmpfile"> <refnamediv> <refname>tmpfile</refname> <refpurpose>Creates a temporary file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>tmpfile</methodname> <void/> </methodsynopsis> <para> Creates a temporary file with an unique name in write mode, returning a file handle similar to the one returned by <function>fopen</function>. The file is automatically removed when closed (using <function>fclose</function>), or when the script ends. </para> <para> For details, consult your system documentation on the <literal>tmpfile(3)</literal> function, as well as the <filename>stdio.h</filename> header file. </para> <para> <example> <title><function>tmpfile</function> example</title> <programlisting role="php"> <![CDATA[ $temp = tmpfile(); fwrite($temp, "writing to tempfile"); fclose($temp); // this removes the file ]]> </programlisting> </example> </para> <para> See also <function>tempnam</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/touch.xml +++ phpdoc-zh/reference/filesystem/functions/touch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.touch"> <refnamediv> <refname>touch</refname> <refpurpose>Sets access and modification time of file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>touch</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>time</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>atime</parameter></methodparam> </methodsynopsis> <para> Attempts to set the access and modification time of the file named by filename to the value given by time. If the option <parameter>time</parameter> is not given, uses the present time. This is equivalent to what utime (sometimes referred to as utimes) does. If the third option <parameter>atime</parameter> is present, the access time of the given filename is set to the value of <parameter>atime</parameter>. Note that the access time is always modified, regardless of the number of parameters. </para> <para> If the file does not exist, it is created. </para> <para> &return.success; <example> <title><function>touch</function> example</title> <programlisting role="php"> <![CDATA[ if (touch ($FileName)) { print "$FileName modification time has been changed to todays date and time"; } else { print "Sorry Could Not change modification time of $FileName"; } ]]> </programlisting> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/umask.xml +++ phpdoc-zh/reference/filesystem/functions/umask.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.umask"> <refnamediv> <refname>umask</refname> <refpurpose>Changes the current umask</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>umask</methodname> <methodparam><type>int</type><parameter>mask</parameter></methodparam> </methodsynopsis> <para> <function>umask</function> sets PHP's umask to mask & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished. </para> <para> <function>umask</function> without arguments simply returns the current umask. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/filesystem/functions/unlink.xml +++ phpdoc-zh/reference/filesystem/functions/unlink.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.unlink"> <refnamediv> <refname>unlink</refname> <refpurpose>Deletes a file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>unlink</methodname> <methodparam><type>string</type><parameter>filename</parameter></methodparam> </methodsynopsis> <para> Deletes <parameter>filename</parameter>. Similar to the Unix C unlink() function. </para> <para> &return.success; </para> <para> See also <function>rmdir</function> for removing directories. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->