Add examples.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166741 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Marcin Gibula 2004-08-18 21:24:33 +00:00
parent 3cee2432fc
commit 641d6a389d
3 changed files with 64 additions and 3 deletions

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
<refentry id="function.xattr-get">
<refnamediv>
@ -46,6 +46,23 @@
<para>
Returns <type>string</type> with value or &false; if attribute doesn't exist.
</para>
<example>
<title><function>xattr_get</function> example</title>
<para>
The following code checks if system administrator has signed the file.
</para>
<programlisting role="php">
<![CDATA[
<?php
$file = '/usr/local/sbin/some_binary;
$signature = xattr_get($file, 'Root signature', XATTR_ROOT);
/* ... check if $signature is valid ... */
?>
]]>
</programlisting>
</example>
<para>
See also <function>xattr_set</function>, <function>xattr_remove</function>,
<function>xattr_list</function>.

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
<refentry id="function.xattr-list">
<refnamediv>
@ -45,6 +45,32 @@
<para>
This function returns <type>array</type> with names of extended attributes.
</para>
<example>
<title><function>xattr_list</function> example</title>
<para>
The following code prints names of all extended attributes of file.
</para>
<programlisting role="php">
<![CDATA[
<?php
$file = 'some_file;
$root_attributes = xattr_list($file, XATTR_ROOT);
$user_attributes = xattr_list($file);
echo "Root attributes: \n";
foreach ($root_attributes as $attr_name) {
printf("%s\n", $attr_name);
}
echo "\n User attributes: \n";
foreach ($attributes as $attr_name) {
printf("%s\n", $attr_name);
}
?>
]]>
</programlisting>
</example>
<para>
See also <function>xattr_get</function>, <function>xattr_set</function>,
<function>xattr_remove</function>.

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
<refentry id="function.xattr-remove">
<refnamediv>
@ -46,6 +46,24 @@
<para>
&return.success;
</para>
<example>
<title><function>xattr_remove</function> example</title>
<para>
The following code removes all extended attributes of file.
</para>
<programlisting role="php">
<![CDATA[
<?php
$file = 'some_file;
$attributes = xattr_list($file);
foreach ($attributes as $attr_name) {
xattr_remove($file, $attr_name);
}
?>
]]>
</programlisting>
</example>
<para>
See also <function>xattr_get</function>, <function>xattr_set</function>,
<function>xattr_list</function>.