tal Thu Feb 28 14:46:18 2002 EDT Modified files: /phpdoc/he/appendices commandline.xml Log: finished Index: phpdoc/he/appendices/commandline.xml diff -u phpdoc/he/appendices/commandline.xml:1.1 phpdoc/he/appendices/commandline.xml:1.2 --- phpdoc/he/appendices/commandline.xml:1.1 Wed Feb 27 10:13:27 2002 +++ phpdoc/he/appendices/commandline.xml Thu Feb 28 14:46:16 2002 @@ -120,37 +120,32 @@ <row> <entry>-l</entry> <entry> - מציאת טעויות תחביריות. אפשרות זו גם מפעילה את אפשרות q-. - אפשרות זו לא תמצא שגיאות פטאליות. כדי למצוא גם שגיאות פטאליות, - יש להשתמש באפשרות f-. + מציאת טעויות תחביריות בקובץ הנתון. אפשרות זו גם + מפעילה את אפשרות q-. אפשרות זו לא תמצא שגיאות פטאליות. + כדי למצוא גם שגיאות פטאליות, יש להשתמש באפשרות f-. </entry> </row> <row> <entry>-m</entry> <entry> - Using this option, PHP prints out the built in - (and loaded) PHP and Zend modules, the PHP - and Zend version numbers, and a short Zend - copyright notice. + הפלט יהיה ההרחבות הרגילות וההרחבות הפעילות + של PHP ו-Zend, גרסאות PHP ו-Zend + והודעת זכויות יוצרים קצרה של Zend. </entry> </row> <row> <entry>-i</entry> <entry> - This command line option calls - <function>phpinfo</function>, and prints - out the results. If PHP is not working well, - it is advisable to make a <literal>php -i</literal> - and see if any error messages are printed out - before or in place of the information tables. + אפשרות זו קוראת לפונקציה <function>phpinfo</function> ומציגה את הפלט. + אם PHP לא עובדת כמו שצריך, מומלץ להריץ אותה עם אפשרות זו + ולראות אם יש הודעות שגיאה לפני או במקום הפלט. </entry> </row> <row> <entry>-h</entry> <entry> - With this option, you can get information about - the actual list of command line options and some - one line descriptions about what they do. + אפשרות זו מציגה את רשימת אפשרויות + שורת הפקודה והסבר קצר על כל אחת. </entry> </row> </tbody> @@ -158,20 +153,18 @@ </table> </para> <para> - The PHP executable can be used to run PHP scripts absolutely - independent from the web server. If you are on a Unix system, - you should add a special first line to your PHP script, and - make it executable, so the system will know, what program - should run the script. On a Windows platform you can associate - <literal>php.exe -q</literal> with the double click option of - the <literal>.php</literal> files, or you can make a batch file - to run the script through PHP. The first line added to the - script to work on Unix won't hurt on Windows, so you can write - cross platform programs this way. A simple example of writing - a command line PHP program can be found below. + הגרסה בת-ההרצה של PHP יכולה לשמש על מנת להריץ סקריפטים + בלי כל קשר אל שרת ה-Web. במערכות UNIX, יש להוסיף שורה ראשונה + מיוחדת לסקריפטי ה-PHP ולהפוך אותם לברי הרצה, כך שהמערכת + תדע לזהות איזו תכנית אמורה להריץ את הסקריפט. + על מערכות חלונות ניתן לשייך את <literal>php.exe -q</literal> על ידי + לחיצה כפולה על קובץ <literal>.php</literal>, ניתן גם ליצור קובץ אצווה (Batch) + ודרכו להריץ את הסקריפטים. במערכת חלונות, PHP תתעלם מן השורה הראשונה + שיש להוסיף במערכות UNIX, כך שניתן ליצןר בקלות סקריפטים חוצי-פלטפורמות. + להלן דוגמה לכתיבת תוכנית שורת פקודה ב-PHP. </para> <example> - <title>Script intended to be run from command line (script.php)</title> + <title>סקריפט שמכוון לרוץ משורת הפקודה (script.php)</title> <programlisting role="php"> <![CDATA[ #!/usr/bin/php -q @@ -198,48 +191,39 @@ </programlisting> </example> <para> - In the script above, we used the special first line to indicate, - that this file should be run by PHP and should not print out HTTP - headers. There are two variables you can use while writing command - line applications with PHP: <varname>$argc</varname> and - <varname>$argv</varname>. The first is the number of arguments plus - one (the name of the script running). The second is an array - containing the arguments, starting with the script name as number - zero (<varname>$argv[0]</varname>). - </para> - <para> - In the program above we checked if there are less or more than one - arguments. Also if the argument was <literal>--help</literal>, - <literal>-help</literal>, <literal>-h</literal> or <literal>-?</literal>, - we printed out the help message, printing the script name dynamically. - If we received some other argument we echoed that out. - </para> - <para> - If you would like to run the above script on Unix, you need to - make it executable, and simply call it as - <literal>script.php echothis</literal> or - <literal>script.php -h</literal>. On Windows, you can make a - batch file for this task: + בסקריפט הנ"ל השתמשנו בשורה הראשונה המיוחדת על מנת לוודא + שהסקריפט יופעל על ידי PHP ולא ידפיס כותרות HTTP. + ישנם שני משתנים שניתן להשתמש בהם בעת כתיבת תוכנית + שורת פקודה ב-PHP: <varname>$argc</varname> ו-<varname>$argv</varname>. + הראשון הוא מספר הארגומנטים ועוד אחד (השם של הסקריפט הנוכחי). + השני הוא מערך המכיל את הארגומנטים, כששם הסקריפט הוא בתא 0 +(<varname>$argv[0]</varname>). + </para> + <para> + בתוכנית הנ"ל בדקנו האם יש יותר מאחד או פחות אחד ארגומנטים. + בנוסף, אם הארגומנט היה <literal>--help</literal>, +<literal>-help</literal>,<literal>-h</literal> או <literal>-?</literal>, + הדפסנו הודעת עזרה, שהראתה את שם הסקריפט באופן דינמי. + אם הארגומנט היה שונה אז הדפסנו אותו. + </para> + <para> + על נמת להריץ את הסקריפט על מערכת UNIX, יש להפוך אותו + לבר-הרצה ולקרוא לו כך: <literal>script.php echothis</literal> או +<literal>script.php -h</literal>. + על מערכת חלונות, ניתן ליצור קובץ אצווה למטרה זו: </para> <example> - <title>Batch file to run a command line PHP script (script.bat)</title> + <title>קובץ אצווה להרצת תוכנית שורת פקודה ב-PHP (script.bat)</title> <programlisting role="winbat"> @c:\php\php.exe -q script.php %1 %2 %3 %4 </programlisting> </example> <para> - Assuming, you named the above program as - <filename>script.php</filename>, and you have your - <filename>php.exe</filename> in - <filename>c:\php\php.exe</filename> this batch file - will run it for you with your added options: - <literal>script.bat echothis</literal> or - <literal>script.bat -h</literal>. + בהנחה שקראתם לתוכנית <filename>script.php</filename> והקובץ + <filename>php.exe</filename> נמצא בנתיב <filename>C:\php\php.exe</filename> + הפקודה הבאה תריץ את הסקריפט עם האפשרויות המצויינות, לדוגמה: + <literal>script.bat echothis</literal> או <literal>script.bat -h</literal>. </para> <para> - See also the <link linkend="ref.readline">Readline</link> - extension documentation for more functions you can use - to enhance your command line applications in PHP. + למידע על דרכים להוסיף שימושיות ופונקציות לתוכניות + שורת פקודה, ניתן לקרוא את התיעוד של הרחבת <link +linkend="ref.readline">Readline</link>. </para> </appendix>