mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Added missing examples.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@267129 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a48b72ac9e
commit
66095fd370
5 changed files with 159 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.chown">
|
||||
<refnamediv>
|
||||
<refname>chown</refname>
|
||||
|
@ -51,6 +51,55 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Simple <function>chown</function> usage</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// File name and username to use
|
||||
$file_name= "foo.php";
|
||||
$path = "/home/sites/php.net/public_html/sandbox" . $file_name ;
|
||||
$user_name = "root";
|
||||
|
||||
// Set the user
|
||||
chown($path, $user_name);
|
||||
|
||||
// Check the result
|
||||
$stat = stat($path);
|
||||
print_r(posix_getpwuid($stat['uid']));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(7) {
|
||||
["name"]=>
|
||||
string(13) "php.net"
|
||||
["passwd"]=>
|
||||
string(1) "x"
|
||||
["uid"]=>
|
||||
int(148864)
|
||||
["gid"]=>
|
||||
int(148910)
|
||||
["gecos"]=>
|
||||
string(13) "php.net"
|
||||
["dir"]=>
|
||||
string(25) "/home/sites/php.net"
|
||||
["shell"]=>
|
||||
string(13) "/sbin/nologin"
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.no-remote;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.is-link">
|
||||
<refnamediv>
|
||||
<refname>is_link</refname>
|
||||
|
@ -41,6 +41,31 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Create and confirm if a file is a symbolic link</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = 'uploads';
|
||||
|
||||
if(is_link($link))
|
||||
{
|
||||
echo(readlink($link));
|
||||
}
|
||||
else
|
||||
{
|
||||
symlink('uploads.php', $link);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.clearstatcache;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.lstat">
|
||||
<refnamediv>
|
||||
<refname>lstat</refname>
|
||||
|
@ -46,6 +46,43 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Comparison of <function>stat</function> and <function>lstat</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
symlink('uploads.php', 'uploads');
|
||||
|
||||
// Contrast information for uploads.php and uploads
|
||||
array_diff(stat('uploads'), lstat('uploads'));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<para>
|
||||
Information that differs between the two files.
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[ino] => 97236376
|
||||
[mode] => 33188
|
||||
[size] => 34
|
||||
[atime] => 1223580003
|
||||
[mtime] => 1223581848
|
||||
[ctime] => 1223581848
|
||||
[blocks] => 8
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.clearstatcache;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.symlink">
|
||||
<refnamediv>
|
||||
<refname>symlink</refname>
|
||||
|
@ -51,6 +51,26 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Create a symbolic link</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$target = 'uploads.php';
|
||||
$link = 'uploads';
|
||||
symlink($target, $link);
|
||||
|
||||
echo(readlink($link));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
¬e.no-windows;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.unlink">
|
||||
<refnamediv>
|
||||
<refname>unlink</refname>
|
||||
|
@ -75,6 +75,29 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Basic <function>unlink</function> usage</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fh = fopen('test.html', 'a');
|
||||
fwrite($fh, '<h1>Hello world!</h1>');
|
||||
fclose($fh);
|
||||
|
||||
mkdir('testdir', 0777);
|
||||
|
||||
unlink('test.html');
|
||||
unlink('testdir');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue