matroz Fri Mar 8 06:42:14 2002 EDT Added files: /phpdoc/he/functions dir.xml Log: almost done
Index: phpdoc/he/functions/dir.xml +++ phpdoc/he/functions/dir.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- EN-Revision: 1.00 Maintainer: matty Status: working --> <reference id="ref.dir"> <title>פונקציות לטיפול בספריות</title> <titleabbrev>ספריות</titleabbrev> <partintro> <simpara> לפונקציות נוספות בנושא כגון : <function>dirname</function>, <function>is_dir</function>, <function>mkdir</function>, ו <function>rmdir</function>,ראה את מודול <link linkend="ref.filesystem">Filesystem</link>. </simpara> </partintro> <refentry id="function.chroot"> <refnamediv> <refname>chroot</refname> <refpurpose>שנה את ספריית ה root</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>bool</type><methodname>chroot</methodname> <methodparam><type>string</type><parameter>directory</parameter></methodparam> </methodsynopsis> <para> משנה את ספריית ה root של התהליך הנוכחי ל <parameter>directory</parameter>. מחזירה &false; אם לא ניתן לשנות את ספריית ה root , &true; אחרת. </para> <note> <para> אין זה מומלץ להשתמש בפונקציה זו כאשר רצים בסביבת שרת האינטרנט, בגלל שלא ניתן יהיה להחזיר את ספריית ה root ל / לאחר סיום הבקשה. פונקציה זו תתפקד כיאה רק כאשר רצים כ CGI. </para> </note> </refsect1> </refentry> <refentry id="function.chdir"> <refnamediv> <refname>chdir</refname> <refpurpose>שנה ספריה</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>bool</type><methodname>chdir</methodname> <methodparam><type>string</type><parameter>directory</parameter></methodparam> </methodsynopsis> <para> משנה את ספריית העבודה הנוכחית של PHP ל <parameter>directory</parameter>. מחזירה &false; אם לא ניתן לשנות ספריה, &true; אחרת. </para> </refsect1> </refentry> <refentry id="class.dir"> <refnamediv> <refname>dir</refname> <refpurpose>directory class</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <classsynopsis> <ooclass><classname>dir</classname></ooclass> <constructorsynopsis> <methodname>dir</methodname> <methodparam><type>string</type><parameter>directory</parameter></methodparam> </constructorsynopsis> <fieldsynopsis> <type>string</type><varname>path</varname> </fieldsynopsis> <methodsynopsis><type>string</type><methodname>read</methodname><void/></methodsynopsis> <methodsynopsis><type>void</type><methodname>rewind</methodname><void/></methodsynopsis> <methodsynopsis><type>void</type><methodname>close</methodname><void/></methodsynopsis> </classsynopsis> <para> מנגנון pseudo-object oriented לקריאה מתוך ספריה. המשתנה <parameter>directory</parameter> נפתח. שני מאפיינים הינם זמינים לאחר שהספריה נפתחה. ניתן להשתמש במאפיין handle עם פומקציות ספריה נוספות כגון <function>readdir</function>, <function>rewinddir</function> and <function>closedir</function>. המאפיין path מקבל את ערך מיקום הספרייה שנפתחה. ישנן שלושה שיטות אפשריות : read, rewind ו close. </para> <para> שים לב לדרך שבה הערך שמחזירה הפונקציה <function>dir</function>'s נבדק בדוגמא מתחת. אנו בודקים בפירוש האם הערך המוחזר זהה(שווה ל וגם מאותו type ,ראה <link linkend="language.operators.comparison"> Comparison Operators</link> למידע נוסף) &false; כי אחרת , כל ערך המוחזר מהספרייה השווה ל &false; יעצור את הלולאה. <example> <title><function>dir</function> דוגמא</title> <programlisting role="php"> <![CDATA[ $d = dir("/etc"); echo "Handle: ".$d->handle."<br>\n"; echo "Path: ".$d->path."<br>\n"; while (false !== ($entry = $d->read())) { echo $entry."<br>\n"; } $d->close(); ]]> </programlisting> </example> </para> <note> <para> הסדר שבו מוחזרים ערכי הספריה לאחר שימוש בשיטה read הם system-dependent. </para> </note> </refsect1> </refentry> <refentry id="function.closedir"> <refnamediv> <refname>closedir</refname> <refpurpose>סגור ספריה</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>void</type><methodname>closedir</methodname> <methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam> </methodsynopsis> <para> סוגרת את stream הספריה המוצבעת על ידי <parameter>dir_handle</parameter>. ה stream חייב היה להיפתח לפני כן עם <function>opendir</function>. </para> </refsect1> </refentry> <refentry id="function.getcwd"> <refnamediv> <refname>getcwd</refname> <refpurpose>החזר את ספרית העבודה הנוכחית</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>string</type><methodname>getcwd</methodname> <void/> </methodsynopsis> <para> מחזירה את ספרית העבודה הנוכחית. </para> </refsect1> </refentry> <refentry id="function.opendir"> <refnamediv> <refname>opendir</refname> <refpurpose>פותחת מצביע לספריה</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>resource</type><methodname>opendir</methodname> <methodparam><type>string</type><parameter>path</parameter></methodparam> </methodsynopsis> <para> מחזירה מצביע לספריה לשימוש בקריאות לפונקציות <function>closedir</function>, <function>readdir</function>, ו <function>rewinddir</function>. </para> <para> אם <parameter>path</parameter> אינו מצביע על ספריה חוקית או שלא ניתן לפתוח את הספריה בגלל הגבלות שימוש או שגיאות במערכת הקבצים, <function>opendir</function> תחזיר &false; ו תייצר שגיאת PHP. ניתן להסתיר את פלט השגיאה <function>opendir</function> על ידי הוספת `@' לפני שם הפונקציה. </para> <para> <example> <title><function>opendir</function> דוגמא</title> <programlisting role="php"> <![CDATA[ <?php if ($dir = @opendir("/tmp")) { while (($file = readdir($dir)) !== false) { echo "$file\n"; } closedir($dir); } ?> ]]> </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.readdir"> <refnamediv> <refname>readdir</refname> <refpurpose>קרא ערך ממצביע הספריה</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>string</type><methodname>readdir</methodname> <methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam> </methodsynopsis> <para> מחזירה את שם הקובץ הבא ממצביע הספריה. שמות הקבצים מוחזרים באותו הסדר שבו הם מאוחסנים במערכת הקבצים. </para> <para> שים לב לדרך שבה הערך שמחזירה הפונקציה <function>readdir</function>'s נבדק בדוגמא מתחת. אנו בודקים בפירוש האם הערך המוחזר זהה(שווה ל וגם מאותו type ,ראה <link linkend="language.operators.comparison"> Comparison Operators</link> למידע נוסף) &false; כי אחרת , כל ערך המוחזר מהספרייה השווה ל &false; יעצור את הלולאה. </para> <para> <example> <title>הצג את כל הקבצים הנמצאים בספריה</title> <programlisting role="php"> <![CDATA[ // Note that !== did not exist until 4.0.0-RC2 <?php $handle=opendir('/path/to/files'); echo "Directory handle: $handle\n"; echo "Files:\n"; /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir($handle))) { echo "$file\n"; } /* This is the WRONG way to loop over the directory. */ while ($file = readdir($handle)) { echo "$file\n"; } closedir($handle); ?> ]]> </programlisting> </example> </para> <para> שים לב כי הפונקציה <function>readdir</function> תחזיר את הערך <literal>.</literal> ו את <literal>..</literal>. אם אינך רוצה בהם, פשוט הסר אותם: <example> <title> הצג את כל הקבצים הנמצאים בספריה ו הסר את <literal>.</literal> ו <literal>..</literal> </title> <programlisting role="php"> <![CDATA[ <?php $handle = opendir('.'); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($handle); ?> ]]> </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.rewinddir"> <refnamediv> <refname>rewinddir</refname> <refpurpose>מציבה את מצביע הספריה בהתחלה</refpurpose> </refnamediv> <refsect1> <title>תיאור</title> <methodsynopsis> <type>void</type><methodname>rewinddir</methodname> <methodparam><type>resource</type><parameter>dir_handle</parameter></methodparam> </methodsynopsis> <para> מציבה את מצביע הספריה המיוצג על ידי <parameter>dir_handle</parameter> להתחלת הספריה. </para> </refsect1> </refentry> </reference> <!-- 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