2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 07:05:15 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.is-readable">
|
2007-02-03 08:13:44 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>is_readable</refname>
|
2009-10-30 14:59:33 +00:00
|
|
|
<refpurpose>Tells whether a file exists and is readable</refpurpose>
|
2007-02-03 08:13:44 +00:00
|
|
|
</refnamediv>
|
2007-06-16 01:17:14 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-02-03 08:13:44 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>is_readable</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2009-10-30 14:59:33 +00:00
|
|
|
Tells whether a file exists and is readable.
|
2007-02-03 08:13:44 +00:00
|
|
|
</para>
|
2007-06-16 01:17:14 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2007-02-03 08:13:44 +00:00
|
|
|
<para>
|
2007-06-16 01:17:14 +00:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>filename</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Path to the file.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2007-02-03 08:13:44 +00:00
|
|
|
</para>
|
2007-06-16 01:17:14 +00:00
|
|
|
</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;
|
2007-02-03 08:13:44 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>is_readable</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
2005-04-05 15:36:41 +00:00
|
|
|
<?php
|
|
|
|
$filename = 'test.txt';
|
|
|
|
if (is_readable($filename)) {
|
2005-04-05 17:36:37 +00:00
|
|
|
echo 'The file is readable';
|
2005-04-05 15:36:41 +00:00
|
|
|
} else {
|
2005-04-05 17:36:37 +00:00
|
|
|
echo 'The file is not readable';
|
2005-04-05 15:36:41 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
]]>
|
2007-02-03 08:13:44 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-06-16 01:17:14 +00:00
|
|
|
</refsect1>
|
2003-02-22 18:55:36 +00:00
|
|
|
|
2010-10-13 08:58:01 +00:00
|
|
|
<refsect1 role="errors">
|
|
|
|
&reftitle.errors;
|
2010-12-13 09:04:07 +00:00
|
|
|
&fs.emits.warning.on.failure;
|
2010-10-13 08:58:01 +00:00
|
|
|
</refsect1>
|
|
|
|
|
2007-06-16 01:17:14 +00:00
|
|
|
<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
|
2007-08-17 16:39:41 +00:00
|
|
|
limitations are not taken into account before PHP 5.1.5.
|
2007-06-16 01:17:14 +00:00
|
|
|
</para>
|
2007-02-03 08:13:44 +00:00
|
|
|
¬e.clearstatcache;
|
|
|
|
&tip.fopen-wrapper.stat;
|
2007-03-23 16:10:05 +00:00
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
The check is done using the real UID/GID instead of the effective one.
|
|
|
|
</para>
|
|
|
|
</note>
|
2012-09-22 14:12:33 +00:00
|
|
|
<para>
|
|
|
|
This function may return &true; for directories. Use
|
|
|
|
<function>is_dir</function> to distinguish file and directory.
|
|
|
|
</para>
|
2007-06-16 01:17:14 +00:00
|
|
|
</refsect1>
|
2007-06-15 19:45:56 +00:00
|
|
|
|
2007-06-16 01:17:14 +00:00
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-02-03 08:13:44 +00:00
|
|
|
<para>
|
2007-06-16 01:17:14 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>is_writable</function></member>
|
|
|
|
<member><function>file_exists</function></member>
|
|
|
|
<member><function>fgets</function></member>
|
|
|
|
</simplelist>
|
2007-02-03 08:13:44 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-06-16 01:17:14 +00:00
|
|
|
|
2007-02-03 08:13:44 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|