cvs: phpdoc-tw /language basic-syntax.xml
| From: | Wei-ching Kao | Date: | Wed, 25 Apr 2007 09:06:36 +0000 |
| Subject: | cvs: phpdoc-tw /language basic-syntax.xml | ||
| Groups: | php.doc.tw | ||
| Request: | Send a blank email to doc-tw+get-97@lists.php.net to get a copy of this message | ||
coldocean Wed Apr 25 09:06:36 2007 UTC
Modified files:
/phpdoc-tw/language basic-syntax.xml
Log:
Update
http://cvs.php.net/viewvc.cgi/phpdoc-tw/language/basic-syntax.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-tw/language/basic-syntax.xml diff -u phpdoc-tw/language/basic-syntax.xml:1.1 phpdoc-tw/language/basic-syntax.xml:1.2 --- phpdoc-tw/language/basic-syntax.xml:1.1 Sun Jun 15 14:55:36 2003 +++ phpdoc-tw/language/basic-syntax.xml Wed Apr 25 09:06:36 2007 @@ -1,186 +1,174 @@ <?xml version="1.0" encoding="big5"?> -<!-- $Revision: 1.1 $ --> - <chapter id="language.basic-syntax"> - <title>°ò¥»»yªk</title> - - <!-- - - NOTE: Last modified: 2001-05-16 13:00 GMT - - the language part is currently under heavy revision. Please do not - not make any heavy (i.e. structural) modifications to this part - for a moment. - - You'd also better not start any translation yet. - - Comments are always welcome at phpdoc@lists.php.net - - Progress: - - intro : DOESN'T EXIST - yet? - new chapter, with some introductionary remarks? - Will be discussed on the ML soon. - basic-syntax: - FINISHED - except maybe moving the 'advanced escaping' - to a better place? - TODO: - - nada - types : Being revised. Added all new types - Boolean and Integer are more or less finished. - The rest isn't. - TODO: - - why is $foo[bar] bad syntax? - - what's the difference between unset($bla) and - $bla = NULL; (it is different!) - - $obj->{expr} syntax - - (unset) cast????? - - $bla = unset <== should've been nuked, don't mention it - - $str{offset} syntax, rather than $str[offset] - - read notes and apply when any of them are useful - - remove notes which have been included here. - - ... - the rest: Not yet started with. - TODO: - - ? - oop : has been revised by Kristian, DONE. - --> - - <sect1 id="language.basic-syntax.phpmode"> - <title>±q HTML ¤¤¶h¥X</title> - - <para> - ·í PHP åªR¤@ÓÀɮ׮ɡA¥¦¬O¤£·|¹ï¤@¯ë¦r¤¸§@¥ô¦ó³B²z¡A°£«D¥¦¹J¤W¤F¨ä¤¤¤@Ó¯S®í¼ÐÅÒ¡A¼Ð©ú PHP µ{¦¡ªº¶}©l¡C³o®É¡APHP ¤~¶}©l¥H PHP µ{¦¡½X¨Ó¸Ñ͏Ӭq¤å¦r¡A¦Ü¨ì¥¦¹J¤W PHP µ{¦¡½Xµ²§ôªº¼ÐÅÒ¡C¦¹µ²§À¼Ð°O¥H«áªº¤å¦r¤S·|³Q·í§@¬O´¶³q¤å¦r¨Ó³B²z¤F¡C³oºØ³B²z¤èªkÅý±z»´©öªº¦b HTML ¤å¥ó¤¤´O¤J PHP ªºµ{¦¡½X¡CPHP ¼ÐÅÒ¥H¤ºªº±N·í§@¬O PHP µ{¦¡½X¨ÓåªR¡B¼ÐÅÒ¥H¥~ªº«hì«Ê¤£°Ê¡C - </para> - - <para> - ¥Î¨Óªí¥Ü PHP µ{¦¡½X°Ï¶ôªº¼ÐÅÒ¦@¦³¥|®M¡A·í¤¤¥u¦³ <?php. . .?> ©M <script - language="php">. . .</script> ¨â®M¬O¸g±`¥i¥H¨Ï¥Îªº¡C¥t¥~¨â®M (<?. . . ?> ¤Î <script language="php">. . .</script>) ¥i¥H³q¹L³]©w &php.ini; ÀɨӶ}Ãö¡CÁöµMµu«¬ªº©M ASP ¦¡ªº¼ÐÅҨϥΰ_¨Ó¸û¬°¤è«K¡A¦ý¦bÝ®e¤W¥¦Ì«o©l²×¤ñ¤£¤Wªø«¬ªº¡C¨Ò¦p¡A¦pªG±zn¦b XML ©Î XHTML ¤¤´O¤J PHPµ{¦¡½X¡A¨º±z´N¤@©wn¨Ï¥Î <?php. . .?> «¬ªº¼ÐÅÒ¥H²Å¦X XML ªº¼Ð·Ç¤F¡C - </para> - - <para> - PHP ¤ä´©ªº¼ÐÅÒ¥]¬A¡G - </para> - +<!-- EN-Revision: 1.49 Maintainer: coldocean Status:ready --> +<chapter id="language.basic-syntax"> + <title>°ò¥»»yªk</title> + <sect1 id="language.basic-syntax.phpmode"> + <title>±q HTML ¤¤¸õ²æ</title> + <para> + ·í PHP ¸ÑªR¤@Ó¤å¥ó®É¡A·|´M§ä¶}©l©Mµ²§ô¼ÐÅÒ¡A¼ÐÅÒ§i¶D + PHP ¶}©l©M°±¤î¸ÑÄÀ¨ä¤¤ªº¥N½X¡C¦¹ºØ¤è¦¡ªº¸ÑªR¥i¥H¨Ï + PHP ´O¤J¨ì¦UºØ¤£¦Pªº¤å¥ó¤¤¡A¤Z¬O¦b¤@¹ï¶}©l©Mµ²§ô¼ÐÅÒ¤§¥~ªº¤º®e³£·|³Q + PHP ¸ÑªR¾¹©¿²¤¡C¤j¦h¼Æ±¡ªp¤U PHP ³£¬O´O¤J¦b HTML ¤å¥ó¤¤ªº¡A¦p¤U¨Ò©Ò¥Ü¡C + <informalexample> + <programlisting role="php"> +<![CDATA[ +<p>This is going to be ignored.</p> +<?php echo 'While this is going to be parsed.'; ?> +<p>This will also be ignored.</p> +]]> + </programlisting> + </informalexample> + </para> + <para> + ÁÙ¥i¥H¥Î§ó¶i¶¥ªºµ²ºc¡G + <example> + <title>¶i¶¥¸õ²æ</title> + <programlisting role="php"> +<![CDATA[ +<?php +if ($expression) { + ?> + <strong>This is true.</strong> + <?php +} else { + ?> + <strong>This is false.</strong> + <?php +} +?> +]]> + </programlisting> + </example> + ¤W¨Ò¥i¥¿±`¤u§@¡A¦]¬°·í PHP ¸I¨ìµ²§ô¼ÐÅÒ ?> + ®É¡A´N²³æ¦a±N¨ä«áªº¤º®eì«Ê¤£°Ê¿é¥Xª½¨ì¸I¨ì¤U¤@Ó¶}©l¼ÐÅÒ¬°¤î¡C·íµM¡A¤W±ªº¨Ò¤l«Ü°µ§@¡A¦ý¬O¹ï¿é¥X¤j°Ï¶ôªº¤å¥»¦Ó¨¥¡A¸õ²æ + PHP ¸ÑªR¼Ò¦¡³q±`¤ñ±N©Ò¦³¤º®e¥Î <function>echo</function> + ©ÎªÌ <function>print</function> ¿é¥X§ó¦³®Ä²v¡C + </para> + <para> + ¥i¥H¦b PHP ¤¤¨Ï¥Î¥|¹ï¤£¦Pªº¶}©l©Mµ²§ô¼ÐÅÒ¡C¨ä¤¤¨âºØ¡A<?php ?> + ©M <script language="php"> </script> Á`¬O¥i¥Îªº¡C¥t¨âºØ¬Oµu¼ÐÅÒ©M + <productname>ASP</productname> ·®æ¼ÐÅÒ¡A¥i¥H¦b &php.ini; + °t¸m¤å¥ó¤¤¥´¶}©ÎÃö³¬¡C¾¨ºÞ¦³¨Ç¤Hı±oµu¼ÐÅÒ©M + <productname>ASP</productname> ·®æ¼ÐÅҫܤè«K¡A¦ý²¾´Ó©Ê¸û®t¡A³q±`¤£±ÀÂË¡C + <note> <para> - <example> - <title>¶h¥X HTML ªº¤è¦¡</title> - <programlisting role="php"> + ¦¹¥~ª`·N¦pªG±N PHP ´O¤J¨ì XML ©Î XHTML + ¤¤«h»Ýn¨Ï¥Î <?php ?> ¥H«O«ù²Å¦X¼Ð·Ç¡C + </para> + </note> + </para> + <para> + <example> + <title>PHP ¶}©l©Mµ²§ô¼ÐÅÒ</title> + <programlisting role="php"> <![CDATA[ -1. <?php echo("if you want to serve XHTML or XML documents, do like this\n"); ?> +1. <?php echo 'if you want to serve XHTML or XML documents, do like this'; ?> -2. <? echo ("this is the simplest, an SGML processing instruction\n"); ?> - <?= expression ?> This is a shortcut for "<? echo expression ?>" - -3. <script language="php"> - echo ("some editors (like FrontPage) don't - like processing instructions"); +2. <script language="php"> + echo 'some editors (like FrontPage) don\'t + like processing instructions'; </script> -4. <% echo ("You may optionally use ASP-style tags"); %> +3. <? echo 'this is the simplest, an SGML processing instruction'; ?> + <?= expression ?> This is a shortcut for "<? echo expression ?>" + +4. <% echo 'You may optionally use ASP-style tags'; %> <%= $variable; # This is a shortcut for "<% echo . . ." %> ]]> - </programlisting> - </example> + </programlisting> + </example> + </para> + <para> + ¤W¨Ò¤¤ªº 1 ©M 2 Á`¬O¥i¥Îªº¡A¨ä¤¤ 1 ¬O³Ì±`¥Î¡A¨Ã«ØÄ³¨Ï¥Îªº¡C + </para> + <para> + µu¼ÐÅÒ¡]¤W¨Ò 3¡^¶È¦b³q¹L &php.ini; °t¸m¤å¥ó¤¤ªº«ü¥O + <link linkend="ini.short-open-tag">short_open_tag</link> + ¥´¶}«á¤~¥i¥Î¡A©ÎªÌ¦b PHP ½sͮɥ[¤J¤F + <option>--enable-short-tags</option> ¿ï¶µ¡C + <note> + <para> + ¦pªG¥Î PHP 3 ÁÙ¥i¥H³q¹L <function>short_tags</function> + ¨ç¦¡¨Ï¥Îµu¼ÐÅÒ¡C<emphasis>¦¹¤èªk¥u¾A¥Î©ó PHP 3¡I</emphasis> </para> - - <para> - ²Ä¤@ºØ¤èªk (<?php. . .?>) ¬O³Q«ØÄ³¨Ï¥Îªº¡A¦]¬°¥¦¥i¥HÅý±z¦b²Å¦X XML ¼Ð·ÇªºXHTML ½X¤¤´O¤J PHP µ{¦¡½X¡C - </para> - - <para> - ²Ä¤GºØ¤èªk¥u¦³¦b±Ò°Ê¥H«á¤~¥i¥H¨Ï¥Î¡A¦Ó¶}±Òªº¤è¦¡¥]¬A¡G¨Ï¥Î <function>short_tags</function> ¨ç¼Æ (¥u¦³ PHP 3 ¦Ó¤w)¡A¦b PHP ²ÕºAÀɤ¤¶}±Ò <link linkend="ini.short-open-tag">short_open_tag</link>¡A©Î¦b½sĶ PHP ®É¦b <command>configure</command> ¥[¤J -enable-short-tag ¿ï¶µ¡C§Y¨Ï¦b php.ini-dist Àɤ¤³Q¹w³]¬°¶}±Ò¡Aµu«¬ªº¼ÐÅÒÁÙ¬O¤£³Q«ØÄ³¨Ï¥Îªº¡C - </para> - - <para> - ²Ä¥|ºØ ASP ¦¡ªº¼ÐÅÒ¥u¦³¦b²ÕºAÀɤ¤¶}±Ò¤F <link linkend="ini.asp-tags">asp_tags</link> «á¤~¯à¨Ï¥Î¡C - - <note> - <para>ASP ¦¡¼ÐÅÒªº¤ä´©¦b 3.0.4 ª©¥»¤~¥[¤Jªº¡C</para> - </note> - </para> - + </note> + </para> + <para> + <productname>ASP</productname> ·®æ¼ÐÅÒ¡]¤W¨Ò 4¡^¶È¦b³q¹L &php.ini; + ³]©w¤å¥ó¤¤ªº«ü¥O + <link linkend="ini.asp-tags">asp_tags</link> ¥´¶}«á¤~¥i¥Î¡C <note> <para> - ¦b¶}µo¤j«¬µ{¦¡¡B½s¼g¥Î¨Ó¦A¤À°tªºµ{¦¡®w¡A©Î±N±zªºµ{¦¡³¡¸p¦b§O¤Hªº¦øªA¾¹¤W®É¡A§ÚÌ«ØÄ³±z¨Ï¥Îªø«¬ªº PHP ¼ÐÅÒ¡A¦]¬°¨Ã«D©Ò¦³ªº¦øªA¾¹³£¶}±Ò¤Fµu¼ÐÅÒªº¤ä´©¡C + ¹ï <productname>ASP</productname> ·®æ¼ÐÅÒªº¤ä´©¬O 3.0.4 ª©²K¥[ªº¡C </para> </note> - + </para> + <note> <para> - µ{¦¡°Ï¶ôªºµ²§À¼Ð°O±N¥]¬AºòÀH¨ä«áªº´«¦æ¦r¤¸¡£Y¦³ªº¸Ü¡¤¡C¦¹¥~¡Aµ²§À¼Ð°O¤w¥]§t¤F¤À¸¹ (;)¡A©Ò¥H±z¤£¥²¦A¬°¥¦¥[¤W¡C + ¦b¥H¤U±¡ªpÀ³Á×§K¨Ï¥Îµu¼ÐÅÒ¡G¶}µo»Ýnµo¦æªºµ{§Ç©ÎªÌ¨ç¦¡®w¡A©ÎªÌ¦b¥Î¤á¤£¯à±±¨îªº¦øªA¾¹¤W¶}µo¡C¦]¬°¥Ø¼Ð¦øªA¾¹¥i¯à¤£¤ä«ùµu¼ÐÅÒ¡C¬°¤F¥N½Xªº²¾´Ó¤Îµo¦æ¡A½T«O¤£n¨Ï¥Îµu¼ÐÅÒ¡C </para> - - <para> - PHP ¤¹³\±z¨Ï¥Î¦p¤Uªº¼gªk¡G - <example><title>¶i¶¥¶h¥X½d¨Ò</title> - <programlisting role="php"> -<![CDATA[ -<?php -if ($expression) { - ?> - <strong>This is true.</strong> - <?php -} else { - ?> - <strong>This is false.</strong> - <?php -} -?> -]]> - </programlisting> - </example> - ¤Wzµ{¦¡½X±N¦p±`ªº¹B§@¡A¦]¬°·í PHP ¹J¤W ?> µ²§À¼Ð°O®É¡A¥¦±N¤£¥[³B²zªº¿é¥X©Ò¦³¤å¦r¡Aª½¨ì¹J¤W¥t¤@Ó¶}©l¼ÐÅÒ¡C·í±zªºµ{¦¡»Ýn¿é¥X¤j¶qªº¤å¦r®É¡A¨Ï¥Î¤Wz¶h¥X¤èªk¿é¥X¤å¦r¨ä®Ä²v·|¤ñ¨Ï¥Î <function>echo</function> ©Î <function>print()</function> ¨ç¼Æ¨Ó±o§ó°ª¡C - </para> - </sect1> - - <sect1 id="language.basic-syntax.instruction-separation"> - <title>«ü¥O¤À¹j</title> - - <simpara> - PHP «ü¥Oªº¤À¹j»P C ©Î Perl ªº¬Û¦P¡A§Y¥H¤À¸¹ (;) ¨Óµ²§ô¤@¦æ±Ôz¡C - </simpara> + </note> + </sect1> - <para> - µ²§À¼Ð°O (?>) ¤]¦P®É·N¨ýµÛ±Ôzªºµ²§ô¡AµL¶·¦A¥[¤À¸¹¡A©Ò¥H¤U¦C¨â¥y¬O¬Û¦Pªº¡G - - <informalexample> - <programlisting role="php"> + <sect1 id="language.basic-syntax.instruction-separation"> + <title>«ü¥O¤À¹j²Å</title> + <para> + ¦P C ©Î Perl ¤@¼Ë¡APHP »Ýn¦b¨CÓ»y¥y«á¥Î¤À¸¹µ²§ô«ü¥O¡C¤@¬q PHP + ¥N½X¤¤ªºµ²§ô¼ÐÅÒÁô§tªí¥Ü¤F¤@Ó¤À¸¹¡F¦b¤@Ó PHP + ¥N½X¬q¤¤ªº³Ì«á¤@¦æ¥i¥H¤£¥Î¤À¸¹µ²§ô¡C¦pªG«á±ÁÙ¦³·s¦æ¡A«hµ{¦¡°Ï¬qªºµ²§ô¼ÐÅÒ¥]§t¤F¦æµ²§ô¼ÐÅÒ¡C + <informalexample> + <programlisting role="php"> <![CDATA[ <?php echo "This is a test"; ?> <?php echo "This is a test" ?> -]]> - </programlisting> - </informalexample> - </para> - </sect1> - <sect1 id="language.basic-syntax.comments"> - <title>µù¸Ñ</title> - - <para> - PHP ¤ä´© C¡BC++ ©M Unix shell ¦¡ªºµù¸Ñ¤èªk¡C½d¨Ò¡G +<?php echo 'We omitted the last closing tag'; +]]> + </programlisting> + </informalexample> + <note> + <para> + ¤å¥ó¥½§Àªº PHP ¥N½X¬qµ²§ô¼ÐÅÒ¬O¿ï¾Ü©Êªº¡A¦³¨Ç±¡ªp¤U·í¨Ï¥Î + <function>include</function> ©ÎªÌ <function>require</function> +®É¬Ù²¤±¼·|§ó¦n¨Ç¡A³o¼Ë¤£´Á±æªºªÅ®æ´N¤£·|¥X²{¦b¤å¥ó¥½§À¡A¤§«á¤´µM¥i¥H¿é¥X¦^ÂЪíÀY¡C¦b¨Ï¥Î¿é¥X½w½Ä®É¤]«Ü«K§Q¡A´N¤£·|¬Ý¨ì¥Ñ¥]§t¤å¥ó¥Í¦¨ªº¤£´Á±æªºªÅ®æ¡C + </para> + </note> + </para> + </sect1> - <informalexample> - <programlisting role="php"> + <sect1 id="language.basic-syntax.comments"> + <title>µù¸Ñ</title> + <para> + PHP ¤ä«ù C¡AC++ ©M Unix Shell ·®æ¡]Perl ·®æ¡^ªºµù¸Ñ¡C¨Ò¦p: + <informalexample> + <programlisting role="php"> <![CDATA[ <?php echo "This is a test"; // This is a one-line c++ style comment /* This is a multi line comment yet another line of comment */ echo "This is yet another test"; - echo "One Final Test"; # This is shell-style style comment + echo 'One Final Test'; # This is a one-line shell-style comment ?> ]]> - </programlisting> - </informalexample> - </para> - - <simpara> - ³æ¦æ¦¡ªºµùÄÀ¤è¦¡¥u¾A¥Î©ó¸Ó¦æ¡£¦Ü¦æ¥½¡¤¡A©Î©Ò¦b°Ï¶ôªº PHP µ{¦¡½X¤º¡Aµø¦óªÌ¥ý¥X²{¡C³oªí¥Ü // ?> «áªº HTML ½X±N·|³Q¿é¥X¡B?> ´N¸õ¥X PHP ¼Ò¦¡¡A¦Ó // «h¤£·|¼vÅT¨ì¼Ò¦¡ªºÂàÅÜ¡C - </simpara> + </programlisting> + </informalexample> + </para> + <simpara> + ³æ¦æµù¸Ñ¶È¶Èµù¸Ñ¨ì¦æ¥½©ÎªÌ·í«eªº PHP µ{¦¡°Ï¬q¡A¬ÝþÓº¥ý¥X²{¡C³o·N¨ýµÛ¦b + <literal>// ... ?></literal> ©ÎªÌ <literal># ... ?></literal> + ¤§«áªº HTML ½X±N³QÅã¥Ü¥X¨Ó¡G?> + ¸õ¥X¤F PHP ¼Ò¦¡¨Ãªð¦^¤F HTML ¼Ò¦¡¡A<literal>//</literal> ©Î <literal>#</literal> + ¨Ã¤£¯à¼vÅT¨ì³o¤@ÂI¡C¦pªG±Ò¥Î¤F + <link linkend="ini.asp-tags">asp_tags</link> ³]©w¿ï¶µ¡A¨ä¦æ¬°©M + <literal>// %></literal> ©Î <literal># %></literal> + ¬Û¦P¡C¤£¹L¡A<literal></script></literal> + ¼ÐÅÒ¦b³æ¦æµù¸Ñ¤¤¤£·|¸õ¥X PHP ¼Ò¦¡¡C + </simpara> + <para> <informalexample> <programlisting role="php"> <![CDATA[ @@ -188,27 +176,28 @@ <p>The header above will say 'This is an example'. ]]> </programlisting> - </informalexample> - - <simpara> - ¦b¨Ï¥Î C ¦¡ªºµùÄÀ®É¡A¤d¸U§O±N¤@Ó C ¦¡µùÄÀ©ñ¦b¥t¤@Ӹ̱¡C³o¦bµùÄÀ¤j¬q¤å¦r®É¸g±`µo¥Í¡C - </simpara> - + </informalexample> + </para> + <simpara> + C ·®æªºµù¸Ñ¦b¸I¨ì²Ä¤@Ó <literal>*/</literal> + ®Éµ²§ô¡Cn½T«O¤£n±_ª¬¨Ï¥Î C ·®æªºµù¸Ñ¡C¸Õ¹Ïµù¸Ñ±¼¤@¤j¶ôµ{¦¡½X®É«Ü®e©ö¥X²{¿ù»~¡C + </simpara> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php - /* + /* echo "This is a test"; /* This comment will cause a problem */ */ ?> ]]> </programlisting> </informalexample> + </para> + </sect1> +</chapter> - </sect1> - </chapter> - <!-- Keep this comment at the end of the file Local variables: mode: sgml
http://cvs.php.net/viewvc.cgi/phpdoc-tw/language/basic-syntax.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc-tw/language/basic-syntax.xml diff -u phpdoc-tw/language/basic-syntax.xml:1.1 phpdoc-tw/language/basic-syntax.xml:1.2 --- phpdoc-tw/language/basic-syntax.xml:1.1 Sun Jun 15 14:55:36 2003 +++ phpdoc-tw/language/basic-syntax.xml Wed Apr 25 09:06:36 2007 @@ -1,186 +1,174 @@ <?xml version="1.0" encoding="big5"?> -<!-- $Revision: 1.1 $ --> - <chapter id="language.basic-syntax"> - <title>°ò¥»»yªk</title> - - <!-- - - NOTE: Last modified: 2001-05-16 13:00 GMT - - the language part is currently under heavy revision. Please do not - not make any heavy (i.e. structural) modifications to this part - for a moment. - - You'd also better not start any translation yet. - - Comments are always welcome at phpdoc@lists.php.net - - Progress: - - intro : DOESN'T EXIST - yet? - new chapter, with some introductionary remarks? - Will be discussed on the ML soon. - basic-syntax: - FINISHED - except maybe moving the 'advanced escaping' - to a better place? - TODO: - - nada - types : Being revised. Added all new types - Boolean and Integer are more or less finished. - The rest isn't. - TODO: - - why is $foo[bar] bad syntax? - - what's the difference between unset($bla) and - $bla = NULL; (it is different!) - - $obj->{expr} syntax - - (unset) cast????? - - $bla = unset <== should've been nuked, don't mention it - - $str{offset} syntax, rather than $str[offset] - - read notes and apply when any of them are useful - - remove notes which have been included here. - - ... - the rest: Not yet started with. - TODO: - - ? - oop : has been revised by Kristian, DONE. - --> - - <sect1 id="language.basic-syntax.phpmode"> - <title>±q HTML ¤¤¶h¥X</title> - - <para> - ·í PHP åªR¤@ÓÀɮ׮ɡA¥¦¬O¤£·|¹ï¤@¯ë¦r¤¸§@¥ô¦ó³B²z¡A°£«D¥¦¹J¤W¤F¨ä¤¤¤@Ó¯S®í¼ÐÅÒ¡A¼Ð©ú PHP µ{¦¡ªº¶}©l¡C³o®É¡APHP ¤~¶}©l¥H PHP µ{¦¡½X¨Ó¸Ñ͏Ӭq¤å¦r¡A¦Ü¨ì¥¦¹J¤W PHP µ{¦¡½Xµ²§ôªº¼ÐÅÒ¡C¦¹µ²§À¼Ð°O¥H«áªº¤å¦r¤S·|³Q·í§@¬O´¶³q¤å¦r¨Ó³B²z¤F¡C³oºØ³B²z¤èªkÅý±z»´©öªº¦b HTML ¤å¥ó¤¤´O¤J PHP ªºµ{¦¡½X¡CPHP ¼ÐÅÒ¥H¤ºªº±N·í§@¬O PHP µ{¦¡½X¨ÓåªR¡B¼ÐÅÒ¥H¥~ªº«hì«Ê¤£°Ê¡C - </para> - - <para> - ¥Î¨Óªí¥Ü PHP µ{¦¡½X°Ï¶ôªº¼ÐÅÒ¦@¦³¥|®M¡A·í¤¤¥u¦³ <?php. . .?> ©M <script - language="php">. . .</script> ¨â®M¬O¸g±`¥i¥H¨Ï¥Îªº¡C¥t¥~¨â®M (<?. . . ?> ¤Î <script language="php">. . .</script>) ¥i¥H³q¹L³]©w &php.ini; ÀɨӶ}Ãö¡CÁöµMµu«¬ªº©M ASP ¦¡ªº¼ÐÅҨϥΰ_¨Ó¸û¬°¤è«K¡A¦ý¦bÝ®e¤W¥¦Ì«o©l²×¤ñ¤£¤Wªø«¬ªº¡C¨Ò¦p¡A¦pªG±zn¦b XML ©Î XHTML ¤¤´O¤J PHPµ{¦¡½X¡A¨º±z´N¤@©wn¨Ï¥Î <?php. . .?> «¬ªº¼ÐÅÒ¥H²Å¦X XML ªº¼Ð·Ç¤F¡C - </para> - - <para> - PHP ¤ä´©ªº¼ÐÅÒ¥]¬A¡G - </para> - +<!-- EN-Revision: 1.49 Maintainer: coldocean Status:ready --> +<chapter id="language.basic-syntax"> + <title>°ò¥»»yªk</title> + <sect1 id="language.basic-syntax.phpmode"> + <title>±q HTML ¤¤¸õ²æ</title> + <para> + ·í PHP ¸ÑªR¤@Ó¤å¥ó®É¡A·|´M§ä¶}©l©Mµ²§ô¼ÐÅÒ¡A¼ÐÅÒ§i¶D + PHP ¶}©l©M°±¤î¸ÑÄÀ¨ä¤¤ªº¥N½X¡C¦¹ºØ¤è¦¡ªº¸ÑªR¥i¥H¨Ï + PHP ´O¤J¨ì¦UºØ¤£¦Pªº¤å¥ó¤¤¡A¤Z¬O¦b¤@¹ï¶}©l©Mµ²§ô¼ÐÅÒ¤§¥~ªº¤º®e³£·|³Q + PHP ¸ÑªR¾¹©¿²¤¡C¤j¦h¼Æ±¡ªp¤U PHP ³£¬O´O¤J¦b HTML ¤å¥ó¤¤ªº¡A¦p¤U¨Ò©Ò¥Ü¡C + <informalexample> + <programlisting role="php"> +<![CDATA[ +<p>This is going to be ignored.</p> +<?php echo 'While this is going to be parsed.'; ?> +<p>This will also be ignored.</p> +]]> + </programlisting> + </informalexample> + </para> + <para> + ÁÙ¥i¥H¥Î§ó¶i¶¥ªºµ²ºc¡G + <example> + <title>¶i¶¥¸õ²æ</title> + <programlisting role="php"> +<![CDATA[ +<?php +if ($expression) { + ?> + <strong>This is true.</strong> + <?php +} else { + ?> + <strong>This is false.</strong> + <?php +} +?> +]]> + </programlisting> + </example> + ¤W¨Ò¥i¥¿±`¤u§@¡A¦]¬°·í PHP ¸I¨ìµ²§ô¼ÐÅÒ ?> + ®É¡A´N²³æ¦a±N¨ä«áªº¤º®eì«Ê¤£°Ê¿é¥Xª½¨ì¸I¨ì¤U¤@Ó¶}©l¼ÐÅÒ¬°¤î¡C·íµM¡A¤W±ªº¨Ò¤l«Ü°µ§@¡A¦ý¬O¹ï¿é¥X¤j°Ï¶ôªº¤å¥»¦Ó¨¥¡A¸õ²æ + PHP ¸ÑªR¼Ò¦¡³q±`¤ñ±N©Ò¦³¤º®e¥Î <function>echo</function> + ©ÎªÌ <function>print</function> ¿é¥X§ó¦³®Ä²v¡C + </para> + <para> + ¥i¥H¦b PHP ¤¤¨Ï¥Î¥|¹ï¤£¦Pªº¶}©l©Mµ²§ô¼ÐÅÒ¡C¨ä¤¤¨âºØ¡A<?php ?> + ©M <script language="php"> </script> Á`¬O¥i¥Îªº¡C¥t¨âºØ¬Oµu¼ÐÅÒ©M + <productname>ASP</productname> ·®æ¼ÐÅÒ¡A¥i¥H¦b &php.ini; + °t¸m¤å¥ó¤¤¥´¶}©ÎÃö³¬¡C¾¨ºÞ¦³¨Ç¤Hı±oµu¼ÐÅÒ©M + <productname>ASP</productname> ·®æ¼ÐÅҫܤè«K¡A¦ý²¾´Ó©Ê¸û®t¡A³q±`¤£±ÀÂË¡C + <note> <para> - <example> - <title>¶h¥X HTML ªº¤è¦¡</title> - <programlisting role="php"> + ¦¹¥~ª`·N¦pªG±N PHP ´O¤J¨ì XML ©Î XHTML + ¤¤«h»Ýn¨Ï¥Î <?php ?> ¥H«O«ù²Å¦X¼Ð·Ç¡C + </para> + </note> + </para> + <para> + <example> + <title>PHP ¶}©l©Mµ²§ô¼ÐÅÒ</title> + <programlisting role="php"> <![CDATA[ -1. <?php echo("if you want to serve XHTML or XML documents, do like this\n"); ?> +1. <?php echo 'if you want to serve XHTML or XML documents, do like this'; ?> -2. <? echo ("this is the simplest, an SGML processing instruction\n"); ?> - <?= expression ?> This is a shortcut for "<? echo expression ?>" - -3. <script language="php"> - echo ("some editors (like FrontPage) don't - like processing instructions"); +2. <script language="php"> + echo 'some editors (like FrontPage) don\'t + like processing instructions'; </script> -4. <% echo ("You may optionally use ASP-style tags"); %> +3. <? echo 'this is the simplest, an SGML processing instruction'; ?> + <?= expression ?> This is a shortcut for "<? echo expression ?>" + +4. <% echo 'You may optionally use ASP-style tags'; %> <%= $variable; # This is a shortcut for "<% echo . . ." %> ]]> - </programlisting> - </example> + </programlisting> + </example> + </para> + <para> + ¤W¨Ò¤¤ªº 1 ©M 2 Á`¬O¥i¥Îªº¡A¨ä¤¤ 1 ¬O³Ì±`¥Î¡A¨Ã«ØÄ³¨Ï¥Îªº¡C + </para> + <para> + µu¼ÐÅÒ¡]¤W¨Ò 3¡^¶È¦b³q¹L &php.ini; °t¸m¤å¥ó¤¤ªº«ü¥O + <link linkend="ini.short-open-tag">short_open_tag</link> + ¥´¶}«á¤~¥i¥Î¡A©ÎªÌ¦b PHP ½sͮɥ[¤J¤F + <option>--enable-short-tags</option> ¿ï¶µ¡C + <note> + <para> + ¦pªG¥Î PHP 3 ÁÙ¥i¥H³q¹L <function>short_tags</function> + ¨ç¦¡¨Ï¥Îµu¼ÐÅÒ¡C<emphasis>¦¹¤èªk¥u¾A¥Î©ó PHP 3¡I</emphasis> </para> - - <para> - ²Ä¤@ºØ¤èªk (<?php. . .?>) ¬O³Q«ØÄ³¨Ï¥Îªº¡A¦]¬°¥¦¥i¥HÅý±z¦b²Å¦X XML ¼Ð·ÇªºXHTML ½X¤¤´O¤J PHP µ{¦¡½X¡C - </para> - - <para> - ²Ä¤GºØ¤èªk¥u¦³¦b±Ò°Ê¥H«á¤~¥i¥H¨Ï¥Î¡A¦Ó¶}±Òªº¤è¦¡¥]¬A¡G¨Ï¥Î <function>short_tags</function> ¨ç¼Æ (¥u¦³ PHP 3 ¦Ó¤w)¡A¦b PHP ²ÕºAÀɤ¤¶}±Ò <link linkend="ini.short-open-tag">short_open_tag</link>¡A©Î¦b½sĶ PHP ®É¦b <command>configure</command> ¥[¤J -enable-short-tag ¿ï¶µ¡C§Y¨Ï¦b php.ini-dist Àɤ¤³Q¹w³]¬°¶}±Ò¡Aµu«¬ªº¼ÐÅÒÁÙ¬O¤£³Q«ØÄ³¨Ï¥Îªº¡C - </para> - - <para> - ²Ä¥|ºØ ASP ¦¡ªº¼ÐÅÒ¥u¦³¦b²ÕºAÀɤ¤¶}±Ò¤F <link linkend="ini.asp-tags">asp_tags</link> «á¤~¯à¨Ï¥Î¡C - - <note> - <para>ASP ¦¡¼ÐÅÒªº¤ä´©¦b 3.0.4 ª©¥»¤~¥[¤Jªº¡C</para> - </note> - </para> - + </note> + </para> + <para> + <productname>ASP</productname> ·®æ¼ÐÅÒ¡]¤W¨Ò 4¡^¶È¦b³q¹L &php.ini; + ³]©w¤å¥ó¤¤ªº«ü¥O + <link linkend="ini.asp-tags">asp_tags</link> ¥´¶}«á¤~¥i¥Î¡C <note> <para> - ¦b¶}µo¤j«¬µ{¦¡¡B½s¼g¥Î¨Ó¦A¤À°tªºµ{¦¡®w¡A©Î±N±zªºµ{¦¡³¡¸p¦b§O¤Hªº¦øªA¾¹¤W®É¡A§ÚÌ«ØÄ³±z¨Ï¥Îªø«¬ªº PHP ¼ÐÅÒ¡A¦]¬°¨Ã«D©Ò¦³ªº¦øªA¾¹³£¶}±Ò¤Fµu¼ÐÅÒªº¤ä´©¡C + ¹ï <productname>ASP</productname> ·®æ¼ÐÅÒªº¤ä´©¬O 3.0.4 ª©²K¥[ªº¡C </para> </note> - + </para> + <note> <para> - µ{¦¡°Ï¶ôªºµ²§À¼Ð°O±N¥]¬AºòÀH¨ä«áªº´«¦æ¦r¤¸¡£Y¦³ªº¸Ü¡¤¡C¦¹¥~¡Aµ²§À¼Ð°O¤w¥]§t¤F¤À¸¹ (;)¡A©Ò¥H±z¤£¥²¦A¬°¥¦¥[¤W¡C + ¦b¥H¤U±¡ªpÀ³Á×§K¨Ï¥Îµu¼ÐÅÒ¡G¶}µo»Ýnµo¦æªºµ{§Ç©ÎªÌ¨ç¦¡®w¡A©ÎªÌ¦b¥Î¤á¤£¯à±±¨îªº¦øªA¾¹¤W¶}µo¡C¦]¬°¥Ø¼Ð¦øªA¾¹¥i¯à¤£¤ä«ùµu¼ÐÅÒ¡C¬°¤F¥N½Xªº²¾´Ó¤Îµo¦æ¡A½T«O¤£n¨Ï¥Îµu¼ÐÅÒ¡C </para> - - <para> - PHP ¤¹³\±z¨Ï¥Î¦p¤Uªº¼gªk¡G - <example><title>¶i¶¥¶h¥X½d¨Ò</title> - <programlisting role="php"> -<![CDATA[ -<?php -if ($expression) { - ?> - <strong>This is true.</strong> - <?php -} else { - ?> - <strong>This is false.</strong> - <?php -} -?> -]]> - </programlisting> - </example> - ¤Wzµ{¦¡½X±N¦p±`ªº¹B§@¡A¦]¬°·í PHP ¹J¤W ?> µ²§À¼Ð°O®É¡A¥¦±N¤£¥[³B²zªº¿é¥X©Ò¦³¤å¦r¡Aª½¨ì¹J¤W¥t¤@Ó¶}©l¼ÐÅÒ¡C·í±zªºµ{¦¡»Ýn¿é¥X¤j¶qªº¤å¦r®É¡A¨Ï¥Î¤Wz¶h¥X¤èªk¿é¥X¤å¦r¨ä®Ä²v·|¤ñ¨Ï¥Î <function>echo</function> ©Î <function>print()</function> ¨ç¼Æ¨Ó±o§ó°ª¡C - </para> - </sect1> - - <sect1 id="language.basic-syntax.instruction-separation"> - <title>«ü¥O¤À¹j</title> - - <simpara> - PHP «ü¥Oªº¤À¹j»P C ©Î Perl ªº¬Û¦P¡A§Y¥H¤À¸¹ (;) ¨Óµ²§ô¤@¦æ±Ôz¡C - </simpara> + </note> + </sect1> - <para> - µ²§À¼Ð°O (?>) ¤]¦P®É·N¨ýµÛ±Ôzªºµ²§ô¡AµL¶·¦A¥[¤À¸¹¡A©Ò¥H¤U¦C¨â¥y¬O¬Û¦Pªº¡G - - <informalexample> - <programlisting role="php"> + <sect1 id="language.basic-syntax.instruction-separation"> + <title>«ü¥O¤À¹j²Å</title> + <para> + ¦P C ©Î Perl ¤@¼Ë¡APHP »Ýn¦b¨CÓ»y¥y«á¥Î¤À¸¹µ²§ô«ü¥O¡C¤@¬q PHP + ¥N½X¤¤ªºµ²§ô¼ÐÅÒÁô§tªí¥Ü¤F¤@Ó¤À¸¹¡F¦b¤@Ó PHP + ¥N½X¬q¤¤ªº³Ì«á¤@¦æ¥i¥H¤£¥Î¤À¸¹µ²§ô¡C¦pªG«á±ÁÙ¦³·s¦æ¡A«hµ{¦¡°Ï¬qªºµ²§ô¼ÐÅÒ¥]§t¤F¦æµ²§ô¼ÐÅÒ¡C + <informalexample> + <programlisting role="php"> <![CDATA[ <?php echo "This is a test"; ?> <?php echo "This is a test" ?> -]]> - </programlisting> - </informalexample> - </para> - </sect1> - <sect1 id="language.basic-syntax.comments"> - <title>µù¸Ñ</title> - - <para> - PHP ¤ä´© C¡BC++ ©M Unix shell ¦¡ªºµù¸Ñ¤èªk¡C½d¨Ò¡G +<?php echo 'We omitted the last closing tag'; +]]> + </programlisting> + </informalexample> + <note> + <para> + ¤å¥ó¥½§Àªº PHP ¥N½X¬qµ²§ô¼ÐÅÒ¬O¿ï¾Ü©Êªº¡A¦³¨Ç±¡ªp¤U·í¨Ï¥Î + <function>include</function> ©ÎªÌ <function>require</function> +®É¬Ù²¤±¼·|§ó¦n¨Ç¡A³o¼Ë¤£´Á±æªºªÅ®æ´N¤£·|¥X²{¦b¤å¥ó¥½§À¡A¤§«á¤´µM¥i¥H¿é¥X¦^ÂЪíÀY¡C¦b¨Ï¥Î¿é¥X½w½Ä®É¤]«Ü«K§Q¡A´N¤£·|¬Ý¨ì¥Ñ¥]§t¤å¥ó¥Í¦¨ªº¤£´Á±æªºªÅ®æ¡C + </para> + </note> + </para> + </sect1> - <informalexample> - <programlisting role="php"> + <sect1 id="language.basic-syntax.comments"> + <title>µù¸Ñ</title> + <para> + PHP ¤ä«ù C¡AC++ ©M Unix Shell ·®æ¡]Perl ·®æ¡^ªºµù¸Ñ¡C¨Ò¦p: + <informalexample> + <programlisting role="php"> <![CDATA[ <?php echo "This is a test"; // This is a one-line c++ style comment /* This is a multi line comment yet another line of comment */ echo "This is yet another test"; - echo "One Final Test"; # This is shell-style style comment + echo 'One Final Test'; # This is a one-line shell-style comment ?> ]]> - </programlisting> - </informalexample> - </para> - - <simpara> - ³æ¦æ¦¡ªºµùÄÀ¤è¦¡¥u¾A¥Î©ó¸Ó¦æ¡£¦Ü¦æ¥½¡¤¡A©Î©Ò¦b°Ï¶ôªº PHP µ{¦¡½X¤º¡Aµø¦óªÌ¥ý¥X²{¡C³oªí¥Ü // ?> «áªº HTML ½X±N·|³Q¿é¥X¡B?> ´N¸õ¥X PHP ¼Ò¦¡¡A¦Ó // «h¤£·|¼vÅT¨ì¼Ò¦¡ªºÂàÅÜ¡C - </simpara> + </programlisting> + </informalexample> + </para> + <simpara> + ³æ¦æµù¸Ñ¶È¶Èµù¸Ñ¨ì¦æ¥½©ÎªÌ·í«eªº PHP µ{¦¡°Ï¬q¡A¬ÝþÓº¥ý¥X²{¡C³o·N¨ýµÛ¦b + <literal>// ... ?></literal> ©ÎªÌ <literal># ... ?></literal> + ¤§«áªº HTML ½X±N³QÅã¥Ü¥X¨Ó¡G?> + ¸õ¥X¤F PHP ¼Ò¦¡¨Ãªð¦^¤F HTML ¼Ò¦¡¡A<literal>//</literal> ©Î <literal>#</literal> + ¨Ã¤£¯à¼vÅT¨ì³o¤@ÂI¡C¦pªG±Ò¥Î¤F + <link linkend="ini.asp-tags">asp_tags</link> ³]©w¿ï¶µ¡A¨ä¦æ¬°©M + <literal>// %></literal> ©Î <literal># %></literal> + ¬Û¦P¡C¤£¹L¡A<literal></script></literal> + ¼ÐÅÒ¦b³æ¦æµù¸Ñ¤¤¤£·|¸õ¥X PHP ¼Ò¦¡¡C + </simpara> + <para> <informalexample> <programlisting role="php"> <![CDATA[ @@ -188,27 +176,28 @@ <p>The header above will say 'This is an example'. ]]> </programlisting> - </informalexample> - - <simpara> - ¦b¨Ï¥Î C ¦¡ªºµùÄÀ®É¡A¤d¸U§O±N¤@Ó C ¦¡µùÄÀ©ñ¦b¥t¤@Ӹ̱¡C³o¦bµùÄÀ¤j¬q¤å¦r®É¸g±`µo¥Í¡C - </simpara> - + </informalexample> + </para> + <simpara> + C ·®æªºµù¸Ñ¦b¸I¨ì²Ä¤@Ó <literal>*/</literal> + ®Éµ²§ô¡Cn½T«O¤£n±_ª¬¨Ï¥Î C ·®æªºµù¸Ñ¡C¸Õ¹Ïµù¸Ñ±¼¤@¤j¶ôµ{¦¡½X®É«Ü®e©ö¥X²{¿ù»~¡C + </simpara> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php - /* + /* echo "This is a test"; /* This comment will cause a problem */ */ ?> ]]> </programlisting> </informalexample> + </para> + </sect1> +</chapter> - </sect1> - </chapter> - <!-- Keep this comment at the end of the file Local variables: mode: sgml