php-doc-en/reference/filesystem/functions/is-readable.xml
Jakub Vrana fa99d27fdb File functions with directories
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@327743 c90b9560-bf6c-de11-be94-00142212c4b1
2012-09-22 14:12:33 +00:00

122 lines
2.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.is-readable">
<refnamediv>
<refname>is_readable</refname>
<refpurpose>Tells whether a file exists and is readable</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>is_readable</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
Tells whether a file exists and is readable.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
Path to the file.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the file or directory specified by
<parameter>filename</parameter> exists and is readable, &false; otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>is_readable</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$filename = 'test.txt';
if (is_readable($filename)) {
echo 'The file is readable';
} else {
echo 'The file is not readable';
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&fs.emits.warning.on.failure;
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<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 before PHP 5.1.5.
</para>
&note.clearstatcache;
&tip.fopen-wrapper.stat;
<note>
<para>
The check is done using the real UID/GID instead of the effective one.
</para>
</note>
<para>
This function may return &true; for directories. Use
<function>is_dir</function> to distinguish file and directory.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>is_writable</function></member>
<member><function>file_exists</function></member>
<member><function>fgets</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->