cvs: phpdoc-zh /faq com.xml html.xml
| From: | Dallas Thunder | Date: | Wed, 04 Sep 2002 20:01:02 +0000 |
| Subject: | cvs: phpdoc-zh /faq com.xml html.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-453@lists.php.net to get a copy of this message | ||
dallas Wed Sep 4 16:01:02 2002 EDT
Modified files:
/phpdoc-zh/faq html.xml com.xml
Log:
Translation completed.
Index: phpdoc-zh/faq/html.xml diff -u phpdoc-zh/faq/html.xml:1.1 phpdoc-zh/faq/html.xml:1.2 --- phpdoc-zh/faq/html.xml:1.1 Mon Sep 2 16:29:28 2002 +++ phpdoc-zh/faq/html.xml Wed Sep 4 16:01:01 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision:1.17 Maintainer: dallas Status: ready --> <chapter id="faq.html"> @@ -7,43 +7,37 @@ <titleabbrev>PHP ºÍ HTML</titleabbrev> <para> - PHP and HTML interact a lot: PHP can generate HTML, and HTML - can pass information to PHP. + PHP ºÍ HTML ÓкܶàÏ໥×÷ÓãºPHP ÄÜÉú³É HTML£¬HTML ¿ÉÒÔÏò PHP ´«µÝÐÅÏ¢¡£ </para> <qandaset> <qandaentry id="faq.html.encoding"> <question> <para> - What encoding/decoding do I need when I pass a value through a form/URL? + µ±ÎÒͨ¹ý±íµ¥£¯URL ´«ÖµÊ±ÐèÒªÓÃʲô±àÂ룯½âÂë·½·¨£¿ </para> </question> <answer> <para> - There are several stages for which encoding is important. Assuming that - you have a <type>string</type> <varname>$data</varname>, which contains - the string you want to pass on in a non-encoded way, these are the - relevant stages: + ÔÚ¼¸¸ö»·½ÚÉϱàÂ뷽ʽºÜÖØÒª¡£¼Ù¶¨ÄãÓÐ <type>string</type> <varname>$data</varname>£¬ÆäÖаüº¬ÁËÄãÏëͨ¹ý·Ç±àÂ뷽ʽ´«µÝµÄ×Ö·û´®£¬ÄÇÕâÊÇÏà¹Ø²½Ö裺 <itemizedlist> <listitem> <para> - HTML interpretation. In order to specify a random string, you - <emphasis>must</emphasis> include it in double quotes, and - htmlspecialchars the whole value. + HTML ½âÎö¡£ÒªÖ¸¶¨Ò»¸öÈÎÒâµÄ×Ö·û´®£¬Äã<emphasis>±ØÐë</emphasis>½«Æä·ÅÔÚË«ÒýºÅÖУ¬²¢Óà + htmlspecialchars ´¦ÀíÕû¸öÖµ¡£ </para> </listitem> <listitem> <para> - URL: A URL consists of several parts. If you want your data to be - interpreted as one item, you <emphasis>must</emphasis> encode it with - <function>urlencode</function>. + URL£ºURL Óɼ¸²¿·Ö×é³É¡£Èç¹ûÄãÏ£Íû×Ô¼ºµÄÊý¾Ý±»µ±×÷ÆäÖÐÒ»ÏîÀ´½âÊÍ£¬Äã<emphasis>±ØÐë</emphasis>Óà + <function>urlencode</function> ¶ÔÆä±àÂë¡£ </para> </listitem> </itemizedlist> </para> <para> <example> - <title>A hidden HTML form element</title> + <title>Òþ²ØµÄ HTML ±íµ¥µ¥Ôª</title> <programlisting role="php"> <![CDATA[ <?php @@ -54,16 +48,13 @@ </example> <note> <simpara> - It is wrong to <function>urlencode</function> - <varname>$data</varname>, because it's the browsers responsibility to - <function>urlencode</function> the data. All popular browsers do that - correctly. Note that this will happen regardless of the method (i.e., - GET or POST). You'll only notice this in case of GET request though, - because POST requests are usually hidden. + Óà <function>urlencode</function> À´´¦Àí <varname>$data</varname> ÊÇ´íÎóµÄ£¬ÒòΪÊÇä¯ÀÀÆ÷µÄÔðÈÎÀ´ + <function>urlencode</function> Êý¾Ý¡£ËùÓÐÁ÷ÐеÄä¯ÀÀÆ÷¶¼ÄÜÕýÈ·´¦Àí¡£×¢Òâ²»ÂÛºÎÖÖ·½·¨£¨ÀýÈç GET »ò + POST£©¶¼»áÕâÑù¡£²»¹ýÄãÖ»»áÔÚÓà GET ÇëÇóʱעÒâµ½ÕâÒ»µã£¬ÒòΪ POST ÇëÇóͨ³£ÊÇÒþ²ØµÄ¡£ </simpara> </note> <example> - <title>Data to be edited by the user</title> + <title>µÈ´ýÓû§±à¼µÄÊý¾Ý</title> <programlisting role="php"> <![CDATA[ <?php @@ -76,18 +67,16 @@ </example> <note> <simpara> - The data is shown in the browser as intended, because the browser will - interpret the HTML escaped symbols. + Êý¾Ý»á°´ÕÕÔ¤ÆÚµÄÏÔʾÔÚä¯ÀÀÆ÷ÖУ¬ÒòΪä¯ÀÀÆ÷»á½âÊÍ HTML תÒå·ûºÅ¡£ </simpara> <simpara> - Upon submitting, either via GET or POST, the data will be urlencoded - by the browser for transferring, and directly urldecoded by PHP. So in - the end, you don't need to do any urlencoding/urldecoding yourself, - everything is handled automagically. + µ±Ìύʱ£¬²»ÂÛÊÇ GET »òÕß POST ·½·¨£¬Êý¾Ý¶¼»á±»ä¯ÀÀÆ÷½øÐÐ urlencode + À´´«Ê䣬²¢Ö±½Ó±» PHP urldecode¡£ËùÒÔ×îÖÕÄã²»ÐèÒª×Ô¼º´¦ÀíÈκΠ+ urlencoding/urldecoding£¬È«¶¼ÊÇ×Ô¶¯´¦ÀíµÄ¡£ </simpara> </note> <example> - <title>In an URL</title> + <title>URL ÖеÄÀý×Ó</title> <programlisting role="php"> <![CDATA[ <?php @@ -99,24 +88,20 @@ </example> <note> <simpara> - In fact you are faking a HTML GET request, therefore it's necessary to - manually <function>urlencode</function> the data. + ÊÂʵÉÏÄãÔÚÄóÔìÒ»¸ö HTML µÄ GET ÇëÇó£¬Òò´ËÐèÒªÊÖ¹¤¶ÔÊý¾Ý½øÐÐ <function>urlencode</function>¡£ </simpara> </note> <note> <simpara> - You need to <function>htmlspecialchars</function> the whole URL, because the - URL occurs as value of an HTML-attribute. In this case, the browser - will first un-<function>htmlspecialchars</function> the value, and then pass - the URL on. PHP will understand the URL correctly, because you - <function>urlencoded</function> the data. + ÄãÐèÒª¶ÔÕû¸ö URL ½øÐÐ <function>htmlspecialchars</function>£¬ÒòΪ URL ÊÇ×÷Ϊ + HTML ÊôÐÔµÄÒ»¸öÖµ³öÏֵġ£ÔÚ±¾ÀýÖУ¬ä¯ÀÀÆ÷»áÊ×ÏȶÔÖµ½øÐÐ + un-<function>htmlspecialchars</function>£¬È»ºóÔÙ´«µÝ´Ë URL¡£PHP ½«ÄÜÕýÈ·Àí½â + URL£¬ÒòΪÄã¶ÔÊý¾Ý½øÐÐÁË <function>urlencoded</function>¡£ </simpara> <simpara> - You'll notice that the <literal>&</literal> in the URL is replaced - by <literal>&amp;</literal>. Although most browsers will recover - if you forget this, this isn't always possible. So even if your URL is - not dynamic, you <emphasis>need</emphasis> to - <function>htmlspecialchars</function> the URL. + Äã»á×¢Òâµ½ URL ÖÐµÄ <literal>&</literal> ±»Ìæ»»³ÉÁË + <literal>&amp;</literal>¡£Èç¹ûÄãÍüÁËÕâÒ»²½£¬¾¡¹Ü´ó¶àÊýä¯ÀÀÆ÷¶¼Äָܻ´£¬µ«Ò²²»×ÜÊÇÕâÑù¡£Òò´Ë¼´Ê¹ + URL ²»ÊǶ¯Ì¬µÄ£¬ÄãÒ²<emphasis>ÐèÒª</emphasis>¶Ô URL ½øÐÐ <function>htmlspecialchars</function>¡£ </simpara> </note> </para> @@ -127,42 +112,34 @@ <qandaentry id="faq.html.form-image"> <question> <para> - I'm trying to use an <input type="image"> tag, but - the $foo.x and $foo.y variables aren't available. - Where are they? + ÎÒÔÚÊÔÓà <input type="image"> ±ê¼Ç£¬µ«ÊÇûÓÐ $foo.x ºÍ $foo.y ±äÁ¿£¬ËüÃÇÄÄÈ¥ÁË£¿ </para> </question> <answer> <para> - When submitting a form, it is possible to use an image instead of - the standard submit button with a tag like: + µ±Ìá½»±íµ¥Ê±£¬¿ÉÒÔÓÃͼƬ´úÌæ±ê×¼µÄÌá½»°´Å¥£¬ÓÃÀàËÆÕâÑùµÄ±ê¼Ç£º <programlisting role="html"> <![CDATA[ <input type="image" src="image.gif" name="foo"> ]]> </programlisting> - When the user clicks somewhere on the image, the accompanying form - will be transmitted to the server with two additional variables: - foo.x and foo.y. + µ±Óû§µã»÷ÁËͼƬµÄÈκβ¿·Ö£¬¸Ã±íµ¥»á±»·¢Ë͵½·þÎñÆ÷²¢¼ÓÉÏÁ½¸ö¶îÍâµÄ±äÁ¿£ºfoo.x ºÍ foo.y¡£ </para> <para> - Because $foo.x and $foo.y are invalid variable names in PHP, they are - automagically converted to $foo_x and $foo_y. That is, the periods - are replaced with underscores. + ÒòΪ $foo.x ºÍ $foo.y ÔÚ PHP ÖÐÊÇ·Ç·¨µÄ±äÁ¿Ãû£¬ËüÃDZ»×Ô¶¯×ª»»³ÉÁË $foo_x ºÍ + $foo_y¡£Ò²¾ÍÊÇÓÃÏ»®Ïß´úÌæÁ˵㡣 </para> </answer> </qandaentry> <qandaentry id="faq.html.arrays"> <question> - <para>How do I create arrays in a HTML <form>?</para> + <para>ÔõÑùÔÚ HTML µÄ <form> Öн¨Á¢Êý×飿</para> </question> <answer> <para> - To get your <form> result sent as an - <link linkend="language.types.array">array</link> to your PHP script - you name the <input>, <select> or <textarea> - elements like this: + ҪʹÄãµÄ <form> ½á¹û±»µ±³É <link linkend="language.types.array">array</link> + ·¢Ë͵½ PHP ½Å±¾£¬ÄãÒª¶Ô <input>£¬<select> »òÕß <textarea> µ¥ÔªÕâÑùÃüÃû£º <programlisting role="html"> <![CDATA[ <input name="MyArray[]"> @@ -171,9 +148,7 @@ <input name="MyArray[]"> ]]> </programlisting> - Notice the square brackets after the variable name, that's what - makes it an array. You can group the elements into different arrays - by assigning the same name to different elements: + ×¢Òâ±äÁ¿ÃûºóµÄ·½À¨ºÅ£¬ÕâʹÆä³ÉΪһ¸öÊý×é¡£Äã¿ÉÒÔͨ¹ý¸ø²»Í¬µÄµ¥Ôª·ÖÅäÏàͬµÄÃû×ÖÀ´°Ñµ¥Ôª·Ö×éµ½²»Í¬µÄÊý×éÀ <programlisting role="html"> <![CDATA[ <input name="MyArray[]"> @@ -182,9 +157,7 @@ <input name="MyOtherArray[]"> ]]> </programlisting> - This produces two arrays, MyArray and MyOtherArray, that gets sent - to the PHP script. It's also possible to assign specific keys - to your arrays: + Õ⽫²úÉúÁ½¸öÊý×飬MyArray ºÍ MyOtherArray£¬²¢·¢Ë͸ø PHP ½Å±¾¡£»¹¿ÉÒÔ¸øÊý×é·ÖÅäÖÆ¶¨µÄ¼üÃû£º <programlisting role="html"> <![CDATA[ <input name="AnotherArray[]"> @@ -193,21 +166,17 @@ <input name="AnotherArray[phone]"> ]]> </programlisting> - The AnotherArray array will now contain the keys 0, 1, email and phone. + AnotherArray Êý×齫°üº¬¼üÃû 0£¬1£¬email ºÍ phone¡£ </para> <para> <note> <para> - Specifying an arrays key is optional in HTML. If you do not specify - the keys, the array gets filled in the order the elements appear in - the form. Our first example will contain keys 0, 1, 2 and 3. + Ö¸¶¨Êý×éµÄ¼üÃûÊÇ HTML µÄ¿ÉÑ¡Ïî¡£Èç¹ûÄã²»Ö¸¶¨¼üÃû£¬ÔòÊý×é±»°´ÕÕµ¥ÔªÔÚ±íµ¥ÖгöÏÖµÄ˳ÐòÌî³ä¡£µÚÒ»¸öÀý×Ó½«°üº¬¼üÃû 0£¬1£¬2 ºÍ 3¡£ </para> </note> </para> <para> - See also - <link linkend="ref.array">Array Functions</link> and - <link linkend="language.variables.external">Variables from outside PHP</link>. + ²Î¼û<link linkend="ref.array">Êý×麯Êý¿â</link>ºÍ<link linkend="language.variables.external">PHP µÄÍⲿ±äÁ¿</link>¡£ </para> </answer> </qandaentry> @@ -215,49 +184,39 @@ <qandaentry id="faq.html.select-multiple"> <question> <para> - How do I get all the results from a select multiple HTML tag? + ÔõÑù´Ó¿É¶àÑ¡µÄ HTML µÄ select multiple ±ê¼ÇÖеõ½ËùÓнá¹û£¿ </para> </question> <answer> <para> - The select multiple tag in an HTML construct allows users to - select multiple items from a list. These items are then passed - to the action handler for the form. The problem is that they - are all passed with the same widget name. ie. + ¿É¶àÑ¡µÄ select multiple ±ê¼ÇÊÇ HTML µÄÒ»¸ö¹¹Ô죬ÔÊÐíÓû§´ÓÒ»¸öÁбíÖÐÑ¡Ôñ¶à¸öÏîÄ¿¡£ÕâЩÏîÄ¿½Ó×ű»´«µÝ¸ø¸Ã±íµ¥ action ÖÐÖ¸¶¨µÄ´¦Àí³ÌÐò¡£ÎÊÌâÊÇËüÃǶ¼»á±»ÓÃͬÑùµÄÃû×Ö´«µÝ¡£ÀýÈ磺 <programlisting role="html"> <![CDATA[ <select name="var" multiple> ]]> </programlisting> - Each selected option will arrive at the action handler as: + ÿ¸ö±»Ñ¡ÏÕâÑù±»´«µÝµ½±íµ¥´¦Àí³ÌÐò£º <programlisting> var=option1 var=option2 var=option3 </programlisting> - Each option will overwrite the contents of the previous - <varname>$var</varname> variable. The solution is to use - PHP's "array from form element" feature. The following - should be used: + ÿ¸öÑ¡Ï¸²¸ÇÇ°ÃæÒ»¸ö <varname>$var</varname> ±äÁ¿µÄÄÚÈÝ¡£½â¾ö·½°¸ÊÇÓà PHP + µÄ¡°±íµ¥µ¥ÔªÊý×é¡±ÌØÐÔ¡£Ê¹Ó÷½·¨ÈçÏ£º <programlisting role="html"> <![CDATA[ <select name="var[]" multiple> ]]> </programlisting> - This tells PHP to treat <varname>$var</varname> as an array and - each assignment of a value to var[] adds an item to the array. - The first item becomes <varname>$var[0]</varname>, the next - <varname>$var[1]</varname>, etc. The <function>count</function> - function can be used to determine how many options were selected, - and the <function>sort</function> function can be used to sort - the option array if necessary. + Õ⽫¸æËß PHP ½« <varname>$var</varname> µ±³ÉÊý×é¶Ô´ý£¬Ã¿¸ö¶Ô var[] + µÄ¸³Öµ¶¼»á¸øÊý×éÔö¼ÓÒ»Ïî¡£µÚÒ»Ï³ÉΪ <varname>$var[0]</varname>£¬ÏÂÒ»¸öÊÇ + <varname>$var[1]</varname>£¬µÈµÈ¡£¿ÉÒÔÓà <function>count</function> + º¯ÊýÀ´²â¶¨Ñ¡ÔñÁ˶àÉÙ¸öÏîÄ¿£¬±ØÒªÊ±¿ÉÒÔÓà <function>sort</function> + º¯ÊýÀ´¶ÔÑ¡ÏîµÄÊý×é½øÐÐÅÅÐò¡£ </para> <para> - Note that if you are using JavaScript the <literal>[]</literal> - on the element name might cause you problems when you try to - refer to the element by name. Use it's numerical form element - ID instead, or enclose the variable name in single quotes and - use that as the index to the elements array, for example: + ×¢ÒâÈç¹ûÄãÔÚ JavaScript ÖÐͨ¹ýÃû×ÖÀ´ÒýÓõ¥Ôª£¬µ¥ÔªÃû×ÖÖÐµÄ <literal>[]</literal> + ¿ÉÄÜ»áÔì³ÉÎÊÌâ¡£ÓÃ±íµ¥µ¥ÔªÖеÄÊý×ÖÐòºÅÀ´Ìæ´ú£¬»òÕß½«±äÁ¿ÃûÓõ¥ÒýºÅÀ¨ÆðÀ´²¢ÓÃÆä×÷Ϊµ¥ÔªÊý×éµÄË÷Òý£¬ÀýÈ磺 <programlisting> variable = documents.forms[0].elements['var[]']; </programlisting> Index: phpdoc-zh/faq/com.xml diff -u phpdoc-zh/faq/com.xml:1.1 phpdoc-zh/faq/com.xml:1.2 --- phpdoc-zh/faq/com.xml:1.1 Mon Sep 2 16:29:28 2002 +++ phpdoc-zh/faq/com.xml Wed Sep 4 16:01:01 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision:1.9 Maintainer: dallas Status: ready --> <chapter id="faq.com"> @@ -7,20 +7,20 @@ <titleabbrev>PHP ºÍ COM</titleabbrev> <para> - PHP can be used to access COM and DCOM objects on Win32 platforms. + PHP ¿ÉÒÔÔÚ Win32 ƽ̨ÖзÃÎÊ COM ºÍ DCOM ¶ÔÏó¡£ </para> <qandaset> <qandaentry id="faq.com.q1"> <question> <para> - I have built a DLL to calculate something. Is there any way to run this DLL under PHP ? + ÎÒ½¨Á¢ÁËÒ»¸ö DLL À´×öijÖÖ¼ÆËã¡£Óа취ÔÚ PHP ÖÐÔËÐÐÕâ¸ö DLL Â𣿠</para> </question> <answer> <para> - If this is a simple DLL there is no way yet to run it from PHP. If the DLL contains a COM - server you may be able to access it if it implements the IDispatch interface. + Èç¹ûÕâÊǸö¼òµ¥µÄ DLL ÄÇô»¹Ã»Óа취ÔÚ PHP ÖÐÔËÐÐËü¡£Èç¹ûÕâ¸ö DLL Öаüº¬ÓÐÒ»¸ö COM + ·þÎñÆ÷²¢ÇÒËüʵÏÖÁË IDispatch ½Ó¿Ú£¬ÄÇÓпÉÄÜ·ÃÎÊËü¡£ </para> </answer> </qandaentry> @@ -28,17 +28,12 @@ <qandaentry id="faq.com.q2"> <question> <para> - What does 'Unsupported variant type: xxxx (0xxxxx)' mean ? + ¡°Unsupported variant type: xxxx (0xxxxx)¡±ÊÇʲôÒâ˼£¿ </para> </question> <answer> <para> - There are dozens of VARIANT types and combinations of them. Most of them are already supported but - a few still have to be implemented. - Arrays are not completely supported. Only single dimensional indexed - only arrays can be passed between PHP and COM. - If you find other types that aren't supported, please report them as a bug (if not already reported) - and provide as much information as available. + Óм¸Ê®ÖÖ VARIANT ÀàÐÍÒÔ¼°ËüÃǵÄ×éºÏ¡£´ó¶àÊýÒѾ±»Ö§³ÖÁ˵«»¹Óм¸ÖÖÉÐδʵÏÖ¡£Êý×éûÓÐÍêÈ«±»Ö§³Ö¡£Ö»ÓÐһάµÄ½öÓÃ×÷Ë÷ÒýµÄÊý×é¿ÉÒÔÔÚ PHP ºÍ COM Ö®¼ä´«µÝ¡£Èç¹ûÄã·¢ÏÖÆäËüδ֧³ÖµÄÀàÐÍ£¬Çëµ±×÷Ò»¸ö bug ±¨¸æ£¨Èç¹ûÉÐδ±»±¨¸æµÄ»°£©²¢Ìṩ¾¡¿ÉÄܶàµÄÐÅÏ¢¡£ </para> </answer> </qandaentry> @@ -46,15 +41,15 @@ <qandaentry id="faq.com.q3"> <question> <para> - Is it possible manipulate visual objects in PHP ? + ÔÚ PHP ÖÐÓпÉÄܲÙ×Ý¿ÉÊÓ¶ÔÏóÂ𣿠</para> </question> <answer> <para> - Generally it is, but as PHP is mostly used as a web scripting language it runs in the web servers context, thus - visual objects will never appear on the servers desktop. - If you use PHP for application scripting e.g. in conjunction with PHP-GTK there is no limitation in accessing and - manipulating visual objects through COM. + Ò»°ãÀ´ËµÊÇ¿ÉÒԵ쬵«ÊÇ PHP ´ó¶¼ÓÃÀ´×÷Ϊ web ½Å±¾ÓïÑÔ²¢ÔËÐÐÔÚ web + ·þÎñÆ÷µÄÉÏÏÂÎÄ»·¾³ÖУ¬Òò´Ë¿ÉÊÓ¶ÔÏó¾ö²»»áÔÚ·þÎñÆ÷µÄ×ÀÃæÉÏÏÔʾ¡£Èç¹ûÄã°Ñ + PHP ÓÃ×÷Ó¦ÓóÌÐò½Å±¾ÀýÈç½áºÏ PHP-GTK À´Ê¹Óã¬ÄÇô·ÃÎʺÍͨ¹ý COM + À´²Ù×Ý¿ÉÊÓ¶ÔÏó·½ÃæÃ»ÓÐÏÞÖÆ¡£ </para> </answer> </qandaentry> @@ -62,12 +57,12 @@ <qandaentry id="faq.com.q4"> <question> <para> - Can I store a COM object in a session ? + ¿ÉÒÔ½«Ò»¸ö COM ¶ÔÏó±£´æÔÚ session ÖÐÂ𣿠</para> </question> <answer> <para> - No, you can't. COM instances are treated as resources and therefore they are only available in a single script's context. + ²»ÐС£COM µÄʵÀý±»¿´×÷ÊÇ×ÊÔ´£¬Òò´ËÖ»ÔÚÒ»¸ö½Å±¾µÄÉÏÏÂÎÄÖÐÓÐЧ¡£ </para> </answer> </qandaentry> @@ -75,13 +70,13 @@ <qandaentry id="faq.com.q5"> <question> <para> - How can I trap COM errors ? + ÔõÑù¿ÉÒÔ²¶»ñ COM µÄ´íÎó£¿ </para> </question> <answer> <para> - Currently it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..), but we are - thinking of a way to implement this. + µ±Ç°³ýÁË PHP ×Ô¼ºÌṩµÄ°ì·¨Ö®Í⣨@£¬track_errors£¬..£©²»¿ÉÄܲ¶»ñ COM + µÄ´íÎ󣬵«ÎÒÃÇÕýÔÚ¿¼ÂÇʵÏÖËüµÄ·½·¨¡£ </para> </answer> </qandaentry> @@ -89,12 +84,12 @@ <qandaentry id="faq.com.q6"> <question> <para> - Can I generate DLL files from PHP scripts like i can in Perl ? + ÎÒÄÜÏñÔÚ Perl ÖÐÒ»Ñù´Ó PHP ½Å±¾Éú³É DLL ÎļþÂ𣿠</para> </question> <answer> <para> - No, unfortunately there is no such tool available for PHP. + ²»ÐУ¬PHP ûÓÐÕâÑùµÄ¹¤¾ß¡£ </para> </answer> </qandaentry> @@ -102,26 +97,26 @@ <qandaentry id="faq.com.q7"> <question> <para> - What does 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' mean ? + ¡°Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}¡±ÊÇʲôÒâ˼£¿ </para> </question> <answer> <para> - This error can have multiple reasons: + ´Ë´íÎó¿ÉÒÔÓжàÖÖÔÒò£º <itemizedlist> <listitem> <simpara> - the CLSID is wrong + ´íÎóµÄ CLSID </simpara> </listitem> <listitem> <simpara> - the requested DLL is missing + ÕÒ²»µ½ËùÇëÇóµÄ DLL </simpara> </listitem> <listitem> <simpara> - the requested component doesn't implement the IDispatch interface + ËùÇëÇóµÄ×é¼þûÓÐʵÏÖ IDispatch ½Ó¿Ú </simpara> </listitem> </itemizedlist> @@ -132,16 +127,15 @@ <qandaentry id="faq.com.q8"> <question> <para> - How can I run COM object from remote server ? + ÔõÑù´ÓÔ¶¶Ë·þÎñÆ÷ÔËÐÐ COM ¶ÔÏó£¿ </para> </question> <answer> <para> - Exactly like you run local objects. You only have to pass the IP of the remote machine as second parameter to - the COM constructor. + ÍêÈ«ºÍÔËÐб¾µØ¶ÔÏóÒ»Ñù¡£Ö»Ð뽫Զ¶Ë·þÎñÆ÷µÄ IP ×÷ΪµÚ¶þ¸ö±äÁ¿´«µÝ¸ø COM µÄ¹¹Ô캯Êý¼´¿É¡£ </para> <para> - Make sure that you have set <literal>com.allow_dcom=true</literal> in your &php.ini;. + È·ÈÏÔÚ &php.ini; ÖÐÉ趨ÁË <literal>com.allow_dcom=true</literal>¡£ </para> </answer> </qandaentry> @@ -149,12 +143,12 @@ <qandaentry id="faq.com.q9"> <question> <para> - I get 'DCOM is disabled in C:\path...\scriptname.php on line 6', what can I do ? + Îҵõ½Ò»¸ö¡°DCOM is disabled in C:\path...\scriptname.php on line 6¡±ÐÅÏ¢£¬Ó¦¸ÃÔõô°ì£¿ </para> </question> <answer> <para> - Edit your &php.ini; and set <literal>com.allow_dcom=true</literal>. + ±à¼ &php.ini; ²¢É趨 <literal>com.allow_dcom=true</literal>¡£ </para> </answer> </qandaentry> @@ -162,14 +156,13 @@ <qandaentry id="faq.com.q10"> <question> <para> - Is it possible to load/manipulate an ActiveX object in a page with PHP ? + ÓпÉÄÜÔÚ PHP Ò³ÃæÖмÓÔØ£¯²Ù×Ý ActiveX ¶ÔÏóÂ𣿠</para> </question> <answer> <para> - This has nothing to do with PHP. ActiveX objects are loaded on client side if they are requested - by the HTML document. There is no relation to the PHP script and therefore there is no direct - server side interaction possible. + Õâ²»¹Ø PHP µÄÊ¡£Èç¹ûÔÚ HTML ÎĵµÖÐÇëÇóµÄ»°£¬ActiveX ¶ÔÏó±»¼ÓÔØÔÚ¿Í»§¶Ë¡£ÕâºÍ PHP + ½Å±¾Ã»ÓйØÏµ£¬Òò´ËÒ²²»¿ÉÄܺͷþÎñÆ÷¶Ë·¢ÉúÖ±½ÓµÄ½»»¥×÷Óᣠ</para> </answer> </qandaentry> @@ -177,20 +170,18 @@ <qandaentry id="faq.com.q11"> <question> <para> - Is it possible to get a running instance of a component ? + ÓпÉÄܵõ½Ò»¸ö×é¼þÔÚÔËÐÐÖеÄʵÀýÂ𣿠</para> </question> <answer> <para> - This is possible with the help of monikers. If you want to get multiple references to the same word instance - you can create that instance like shown: + ÔڴºŵİïÖúÏÂÕâÓпÉÄÜ¡£Èç¹ûÄãÏëµÃµ½Í¬Ò»¸ö word ʵÀýµÄ¶à¸öÒýÓÃÄã¿ÉÒÔÕâÑù½¨Á¢´ËʵÀý£º </para> <programlisting role="php"> $word = new COM("C:\docs\word.doc"); </programlisting> <para> - This will create a new instance if there is no running instance available or it will return a handle to the - running instance, if available. + Èç¹ûûÓÐÔËÐÐÖеÄʵÀýÕ⽫½¨Á¢Ò»¸öеÄʵÀý£¬·ñÔò½«»á·µ»ØÕýÔÚÔËÐÐÖеÄʵÀýµÄ¾ä±ú£¬Èç¹û¿ÉÓõϰ¡£ </para> </answer> </qandaentry> @@ -198,12 +189,12 @@ <qandaentry id="faq.com.q12"> <question> <para> - Is there a way to handle an event sent from COM object ? + Óа취´¦Àí COM ¶ÔÏóÖз¢Ë͵ÄʼþÂ𣿠</para> </question> <answer> <para> - Not yet. + »¹²»ÄÜ¡£ </para> </answer> </qandaentry> @@ -211,14 +202,12 @@ <qandaentry id="faq.com.q13"> <question> <para> - I'm having problems when trying to invoke a method of a COM object - which exposes more than one interface. What can I do ? + ÎÒÔÚ³¢ÊÔµ÷ÓÃÒ»¸ö´ò¿ªÁ˶àÓÚÒ»¸ö½Ó¿ÚµÄ COM ¶ÔÏóÖеķ½·¨Ê±Åöµ½ÎÊÌ⣬Ӧ¸ÃÔõô°ì£¿ </para> </question> <answer> <para> - The answer is as simple as unsatisfying. I don't know exactly but i think you can do nothing. - If someone has specific information about this, please let <ulink url="mailto:&email.harald;">me</ulink> know :) + ÎÒÒ²²»ÖªµÀÔõô°ì£¬ÎÒÏëÕâû°ì·¨¡£Èç¹ûʲôÈËÓжԴËÎÊÌâµÄÃ÷È·ÐÅÏ¢Çë<ulink url="mailto:&email.harald;">¸æËßÎÒ</ulink>¡£:) </para> </answer> </qandaentry> @@ -226,13 +215,12 @@ <qandaentry id="faq.com.q14"> <question> <para> - So PHP works with COM, how about COM+ ? + Õâô˵ PHP ¿ÉÒÔºÍ COM Ò»Æð¹¤×÷£¬ÄÇô COM+ ÄØ£¿ </para> </question> <answer> <para> - COM+ extends COM by a framework for managing components through MTS and MSMQ but there is nothing special that - PHP has to support to use such components. + COM+ ͨ¹ýʹÓà MTS ºÍ MSMQ À´¹ÜÀí×é¼þµÄ¿ò¼ÜÀ©Õ¹ÁË COM£¬µ«²¢Ã»ÓÐÊ²Ã´ÌØÊâÖ®´¦Ê¹ PHP ·ÇÒªÖ§³ÖÕâÑùµÄ×é¼þ¡£ </para> </answer> </qandaentry> @@ -240,16 +228,12 @@ <qandaentry id="faq.com.q15"> <question> <para> - If PHP can manipulate COM objects, can we imagine to use - MTS to manage components resources, in conjunction with PHP ? + Èç¹û PHP ¿ÉÒÔ²Ù×Ý COM ¶ÔÏó£¬ÄÇô¿ÉÒÔÉèÏë½áºÏ PHP Óà MTS À´¹ÜÀí×é¼þ×ÊÔ´Â𣿠</para> </question> <answer> <para> - PHP itself doesn't handle transactions yet. Thus if an error - occurs no rollback is initiated. If you use components that - support transactions you will have to implement the - transaction management yourself. + PHP ±¾Éí»¹²¢²»´¦ÀíÊÂÎñ¡£Òò¶øÈç¹û³ö´íÒ²²»»á·¢¶¯³·»Ø»úÖÆ¡£Èç¹ûÄãʹÓÃÁËÖ§³ÖÊÂÎñ´¦ÀíµÄ×é¼þÄÇÄã²»µÃ²»×Ô¼ºÊµÏÖÊÂÎñ¹ÜÀí¡£ </para> </answer> </qandaentry>
Index: phpdoc-zh/faq/html.xml diff -u phpdoc-zh/faq/html.xml:1.1 phpdoc-zh/faq/html.xml:1.2 --- phpdoc-zh/faq/html.xml:1.1 Mon Sep 2 16:29:28 2002 +++ phpdoc-zh/faq/html.xml Wed Sep 4 16:01:01 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision:1.17 Maintainer: dallas Status: ready --> <chapter id="faq.html"> @@ -7,43 +7,37 @@ <titleabbrev>PHP ºÍ HTML</titleabbrev> <para> - PHP and HTML interact a lot: PHP can generate HTML, and HTML - can pass information to PHP. + PHP ºÍ HTML ÓкܶàÏ໥×÷ÓãºPHP ÄÜÉú³É HTML£¬HTML ¿ÉÒÔÏò PHP ´«µÝÐÅÏ¢¡£ </para> <qandaset> <qandaentry id="faq.html.encoding"> <question> <para> - What encoding/decoding do I need when I pass a value through a form/URL? + µ±ÎÒͨ¹ý±íµ¥£¯URL ´«ÖµÊ±ÐèÒªÓÃʲô±àÂ룯½âÂë·½·¨£¿ </para> </question> <answer> <para> - There are several stages for which encoding is important. Assuming that - you have a <type>string</type> <varname>$data</varname>, which contains - the string you want to pass on in a non-encoded way, these are the - relevant stages: + ÔÚ¼¸¸ö»·½ÚÉϱàÂ뷽ʽºÜÖØÒª¡£¼Ù¶¨ÄãÓÐ <type>string</type> <varname>$data</varname>£¬ÆäÖаüº¬ÁËÄãÏëͨ¹ý·Ç±àÂ뷽ʽ´«µÝµÄ×Ö·û´®£¬ÄÇÕâÊÇÏà¹Ø²½Ö裺 <itemizedlist> <listitem> <para> - HTML interpretation. In order to specify a random string, you - <emphasis>must</emphasis> include it in double quotes, and - htmlspecialchars the whole value. + HTML ½âÎö¡£ÒªÖ¸¶¨Ò»¸öÈÎÒâµÄ×Ö·û´®£¬Äã<emphasis>±ØÐë</emphasis>½«Æä·ÅÔÚË«ÒýºÅÖУ¬²¢Óà + htmlspecialchars ´¦ÀíÕû¸öÖµ¡£ </para> </listitem> <listitem> <para> - URL: A URL consists of several parts. If you want your data to be - interpreted as one item, you <emphasis>must</emphasis> encode it with - <function>urlencode</function>. + URL£ºURL Óɼ¸²¿·Ö×é³É¡£Èç¹ûÄãÏ£Íû×Ô¼ºµÄÊý¾Ý±»µ±×÷ÆäÖÐÒ»ÏîÀ´½âÊÍ£¬Äã<emphasis>±ØÐë</emphasis>Óà + <function>urlencode</function> ¶ÔÆä±àÂë¡£ </para> </listitem> </itemizedlist> </para> <para> <example> - <title>A hidden HTML form element</title> + <title>Òþ²ØµÄ HTML ±íµ¥µ¥Ôª</title> <programlisting role="php"> <![CDATA[ <?php @@ -54,16 +48,13 @@ </example> <note> <simpara> - It is wrong to <function>urlencode</function> - <varname>$data</varname>, because it's the browsers responsibility to - <function>urlencode</function> the data. All popular browsers do that - correctly. Note that this will happen regardless of the method (i.e., - GET or POST). You'll only notice this in case of GET request though, - because POST requests are usually hidden. + Óà <function>urlencode</function> À´´¦Àí <varname>$data</varname> ÊÇ´íÎóµÄ£¬ÒòΪÊÇä¯ÀÀÆ÷µÄÔðÈÎÀ´ + <function>urlencode</function> Êý¾Ý¡£ËùÓÐÁ÷ÐеÄä¯ÀÀÆ÷¶¼ÄÜÕýÈ·´¦Àí¡£×¢Òâ²»ÂÛºÎÖÖ·½·¨£¨ÀýÈç GET »ò + POST£©¶¼»áÕâÑù¡£²»¹ýÄãÖ»»áÔÚÓà GET ÇëÇóʱעÒâµ½ÕâÒ»µã£¬ÒòΪ POST ÇëÇóͨ³£ÊÇÒþ²ØµÄ¡£ </simpara> </note> <example> - <title>Data to be edited by the user</title> + <title>µÈ´ýÓû§±à¼µÄÊý¾Ý</title> <programlisting role="php"> <![CDATA[ <?php @@ -76,18 +67,16 @@ </example> <note> <simpara> - The data is shown in the browser as intended, because the browser will - interpret the HTML escaped symbols. + Êý¾Ý»á°´ÕÕÔ¤ÆÚµÄÏÔʾÔÚä¯ÀÀÆ÷ÖУ¬ÒòΪä¯ÀÀÆ÷»á½âÊÍ HTML תÒå·ûºÅ¡£ </simpara> <simpara> - Upon submitting, either via GET or POST, the data will be urlencoded - by the browser for transferring, and directly urldecoded by PHP. So in - the end, you don't need to do any urlencoding/urldecoding yourself, - everything is handled automagically. + µ±Ìύʱ£¬²»ÂÛÊÇ GET »òÕß POST ·½·¨£¬Êý¾Ý¶¼»á±»ä¯ÀÀÆ÷½øÐÐ urlencode + À´´«Ê䣬²¢Ö±½Ó±» PHP urldecode¡£ËùÒÔ×îÖÕÄã²»ÐèÒª×Ô¼º´¦ÀíÈκΠ+ urlencoding/urldecoding£¬È«¶¼ÊÇ×Ô¶¯´¦ÀíµÄ¡£ </simpara> </note> <example> - <title>In an URL</title> + <title>URL ÖеÄÀý×Ó</title> <programlisting role="php"> <![CDATA[ <?php @@ -99,24 +88,20 @@ </example> <note> <simpara> - In fact you are faking a HTML GET request, therefore it's necessary to - manually <function>urlencode</function> the data. + ÊÂʵÉÏÄãÔÚÄóÔìÒ»¸ö HTML µÄ GET ÇëÇó£¬Òò´ËÐèÒªÊÖ¹¤¶ÔÊý¾Ý½øÐÐ <function>urlencode</function>¡£ </simpara> </note> <note> <simpara> - You need to <function>htmlspecialchars</function> the whole URL, because the - URL occurs as value of an HTML-attribute. In this case, the browser - will first un-<function>htmlspecialchars</function> the value, and then pass - the URL on. PHP will understand the URL correctly, because you - <function>urlencoded</function> the data. + ÄãÐèÒª¶ÔÕû¸ö URL ½øÐÐ <function>htmlspecialchars</function>£¬ÒòΪ URL ÊÇ×÷Ϊ + HTML ÊôÐÔµÄÒ»¸öÖµ³öÏֵġ£ÔÚ±¾ÀýÖУ¬ä¯ÀÀÆ÷»áÊ×ÏȶÔÖµ½øÐÐ + un-<function>htmlspecialchars</function>£¬È»ºóÔÙ´«µÝ´Ë URL¡£PHP ½«ÄÜÕýÈ·Àí½â + URL£¬ÒòΪÄã¶ÔÊý¾Ý½øÐÐÁË <function>urlencoded</function>¡£ </simpara> <simpara> - You'll notice that the <literal>&</literal> in the URL is replaced - by <literal>&amp;</literal>. Although most browsers will recover - if you forget this, this isn't always possible. So even if your URL is - not dynamic, you <emphasis>need</emphasis> to - <function>htmlspecialchars</function> the URL. + Äã»á×¢Òâµ½ URL ÖÐµÄ <literal>&</literal> ±»Ìæ»»³ÉÁË + <literal>&amp;</literal>¡£Èç¹ûÄãÍüÁËÕâÒ»²½£¬¾¡¹Ü´ó¶àÊýä¯ÀÀÆ÷¶¼Äָܻ´£¬µ«Ò²²»×ÜÊÇÕâÑù¡£Òò´Ë¼´Ê¹ + URL ²»ÊǶ¯Ì¬µÄ£¬ÄãÒ²<emphasis>ÐèÒª</emphasis>¶Ô URL ½øÐÐ <function>htmlspecialchars</function>¡£ </simpara> </note> </para> @@ -127,42 +112,34 @@ <qandaentry id="faq.html.form-image"> <question> <para> - I'm trying to use an <input type="image"> tag, but - the $foo.x and $foo.y variables aren't available. - Where are they? + ÎÒÔÚÊÔÓà <input type="image"> ±ê¼Ç£¬µ«ÊÇûÓÐ $foo.x ºÍ $foo.y ±äÁ¿£¬ËüÃÇÄÄÈ¥ÁË£¿ </para> </question> <answer> <para> - When submitting a form, it is possible to use an image instead of - the standard submit button with a tag like: + µ±Ìá½»±íµ¥Ê±£¬¿ÉÒÔÓÃͼƬ´úÌæ±ê×¼µÄÌá½»°´Å¥£¬ÓÃÀàËÆÕâÑùµÄ±ê¼Ç£º <programlisting role="html"> <![CDATA[ <input type="image" src="image.gif" name="foo"> ]]> </programlisting> - When the user clicks somewhere on the image, the accompanying form - will be transmitted to the server with two additional variables: - foo.x and foo.y. + µ±Óû§µã»÷ÁËͼƬµÄÈκβ¿·Ö£¬¸Ã±íµ¥»á±»·¢Ë͵½·þÎñÆ÷²¢¼ÓÉÏÁ½¸ö¶îÍâµÄ±äÁ¿£ºfoo.x ºÍ foo.y¡£ </para> <para> - Because $foo.x and $foo.y are invalid variable names in PHP, they are - automagically converted to $foo_x and $foo_y. That is, the periods - are replaced with underscores. + ÒòΪ $foo.x ºÍ $foo.y ÔÚ PHP ÖÐÊÇ·Ç·¨µÄ±äÁ¿Ãû£¬ËüÃDZ»×Ô¶¯×ª»»³ÉÁË $foo_x ºÍ + $foo_y¡£Ò²¾ÍÊÇÓÃÏ»®Ïß´úÌæÁ˵㡣 </para> </answer> </qandaentry> <qandaentry id="faq.html.arrays"> <question> - <para>How do I create arrays in a HTML <form>?</para> + <para>ÔõÑùÔÚ HTML µÄ <form> Öн¨Á¢Êý×飿</para> </question> <answer> <para> - To get your <form> result sent as an - <link linkend="language.types.array">array</link> to your PHP script - you name the <input>, <select> or <textarea> - elements like this: + ҪʹÄãµÄ <form> ½á¹û±»µ±³É <link linkend="language.types.array">array</link> + ·¢Ë͵½ PHP ½Å±¾£¬ÄãÒª¶Ô <input>£¬<select> »òÕß <textarea> µ¥ÔªÕâÑùÃüÃû£º <programlisting role="html"> <![CDATA[ <input name="MyArray[]"> @@ -171,9 +148,7 @@ <input name="MyArray[]"> ]]> </programlisting> - Notice the square brackets after the variable name, that's what - makes it an array. You can group the elements into different arrays - by assigning the same name to different elements: + ×¢Òâ±äÁ¿ÃûºóµÄ·½À¨ºÅ£¬ÕâʹÆä³ÉΪһ¸öÊý×é¡£Äã¿ÉÒÔͨ¹ý¸ø²»Í¬µÄµ¥Ôª·ÖÅäÏàͬµÄÃû×ÖÀ´°Ñµ¥Ôª·Ö×éµ½²»Í¬µÄÊý×éÀ <programlisting role="html"> <![CDATA[ <input name="MyArray[]"> @@ -182,9 +157,7 @@ <input name="MyOtherArray[]"> ]]> </programlisting> - This produces two arrays, MyArray and MyOtherArray, that gets sent - to the PHP script. It's also possible to assign specific keys - to your arrays: + Õ⽫²úÉúÁ½¸öÊý×飬MyArray ºÍ MyOtherArray£¬²¢·¢Ë͸ø PHP ½Å±¾¡£»¹¿ÉÒÔ¸øÊý×é·ÖÅäÖÆ¶¨µÄ¼üÃû£º <programlisting role="html"> <![CDATA[ <input name="AnotherArray[]"> @@ -193,21 +166,17 @@ <input name="AnotherArray[phone]"> ]]> </programlisting> - The AnotherArray array will now contain the keys 0, 1, email and phone. + AnotherArray Êý×齫°üº¬¼üÃû 0£¬1£¬email ºÍ phone¡£ </para> <para> <note> <para> - Specifying an arrays key is optional in HTML. If you do not specify - the keys, the array gets filled in the order the elements appear in - the form. Our first example will contain keys 0, 1, 2 and 3. + Ö¸¶¨Êý×éµÄ¼üÃûÊÇ HTML µÄ¿ÉÑ¡Ïî¡£Èç¹ûÄã²»Ö¸¶¨¼üÃû£¬ÔòÊý×é±»°´ÕÕµ¥ÔªÔÚ±íµ¥ÖгöÏÖµÄ˳ÐòÌî³ä¡£µÚÒ»¸öÀý×Ó½«°üº¬¼üÃû 0£¬1£¬2 ºÍ 3¡£ </para> </note> </para> <para> - See also - <link linkend="ref.array">Array Functions</link> and - <link linkend="language.variables.external">Variables from outside PHP</link>. + ²Î¼û<link linkend="ref.array">Êý×麯Êý¿â</link>ºÍ<link linkend="language.variables.external">PHP µÄÍⲿ±äÁ¿</link>¡£ </para> </answer> </qandaentry> @@ -215,49 +184,39 @@ <qandaentry id="faq.html.select-multiple"> <question> <para> - How do I get all the results from a select multiple HTML tag? + ÔõÑù´Ó¿É¶àÑ¡µÄ HTML µÄ select multiple ±ê¼ÇÖеõ½ËùÓнá¹û£¿ </para> </question> <answer> <para> - The select multiple tag in an HTML construct allows users to - select multiple items from a list. These items are then passed - to the action handler for the form. The problem is that they - are all passed with the same widget name. ie. + ¿É¶àÑ¡µÄ select multiple ±ê¼ÇÊÇ HTML µÄÒ»¸ö¹¹Ô죬ÔÊÐíÓû§´ÓÒ»¸öÁбíÖÐÑ¡Ôñ¶à¸öÏîÄ¿¡£ÕâЩÏîÄ¿½Ó×ű»´«µÝ¸ø¸Ã±íµ¥ action ÖÐÖ¸¶¨µÄ´¦Àí³ÌÐò¡£ÎÊÌâÊÇËüÃǶ¼»á±»ÓÃͬÑùµÄÃû×Ö´«µÝ¡£ÀýÈ磺 <programlisting role="html"> <![CDATA[ <select name="var" multiple> ]]> </programlisting> - Each selected option will arrive at the action handler as: + ÿ¸ö±»Ñ¡ÏÕâÑù±»´«µÝµ½±íµ¥´¦Àí³ÌÐò£º <programlisting> var=option1 var=option2 var=option3 </programlisting> - Each option will overwrite the contents of the previous - <varname>$var</varname> variable. The solution is to use - PHP's "array from form element" feature. The following - should be used: + ÿ¸öÑ¡Ï¸²¸ÇÇ°ÃæÒ»¸ö <varname>$var</varname> ±äÁ¿µÄÄÚÈÝ¡£½â¾ö·½°¸ÊÇÓà PHP + µÄ¡°±íµ¥µ¥ÔªÊý×é¡±ÌØÐÔ¡£Ê¹Ó÷½·¨ÈçÏ£º <programlisting role="html"> <![CDATA[ <select name="var[]" multiple> ]]> </programlisting> - This tells PHP to treat <varname>$var</varname> as an array and - each assignment of a value to var[] adds an item to the array. - The first item becomes <varname>$var[0]</varname>, the next - <varname>$var[1]</varname>, etc. The <function>count</function> - function can be used to determine how many options were selected, - and the <function>sort</function> function can be used to sort - the option array if necessary. + Õ⽫¸æËß PHP ½« <varname>$var</varname> µ±³ÉÊý×é¶Ô´ý£¬Ã¿¸ö¶Ô var[] + µÄ¸³Öµ¶¼»á¸øÊý×éÔö¼ÓÒ»Ïî¡£µÚÒ»Ï³ÉΪ <varname>$var[0]</varname>£¬ÏÂÒ»¸öÊÇ + <varname>$var[1]</varname>£¬µÈµÈ¡£¿ÉÒÔÓà <function>count</function> + º¯ÊýÀ´²â¶¨Ñ¡ÔñÁ˶àÉÙ¸öÏîÄ¿£¬±ØÒªÊ±¿ÉÒÔÓà <function>sort</function> + º¯ÊýÀ´¶ÔÑ¡ÏîµÄÊý×é½øÐÐÅÅÐò¡£ </para> <para> - Note that if you are using JavaScript the <literal>[]</literal> - on the element name might cause you problems when you try to - refer to the element by name. Use it's numerical form element - ID instead, or enclose the variable name in single quotes and - use that as the index to the elements array, for example: + ×¢ÒâÈç¹ûÄãÔÚ JavaScript ÖÐͨ¹ýÃû×ÖÀ´ÒýÓõ¥Ôª£¬µ¥ÔªÃû×ÖÖÐµÄ <literal>[]</literal> + ¿ÉÄÜ»áÔì³ÉÎÊÌâ¡£ÓÃ±íµ¥µ¥ÔªÖеÄÊý×ÖÐòºÅÀ´Ìæ´ú£¬»òÕß½«±äÁ¿ÃûÓõ¥ÒýºÅÀ¨ÆðÀ´²¢ÓÃÆä×÷Ϊµ¥ÔªÊý×éµÄË÷Òý£¬ÀýÈ磺 <programlisting> variable = documents.forms[0].elements['var[]']; </programlisting> Index: phpdoc-zh/faq/com.xml diff -u phpdoc-zh/faq/com.xml:1.1 phpdoc-zh/faq/com.xml:1.2 --- phpdoc-zh/faq/com.xml:1.1 Mon Sep 2 16:29:28 2002 +++ phpdoc-zh/faq/com.xml Wed Sep 4 16:01:01 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision:1.9 Maintainer: dallas Status: ready --> <chapter id="faq.com"> @@ -7,20 +7,20 @@ <titleabbrev>PHP ºÍ COM</titleabbrev> <para> - PHP can be used to access COM and DCOM objects on Win32 platforms. + PHP ¿ÉÒÔÔÚ Win32 ƽ̨ÖзÃÎÊ COM ºÍ DCOM ¶ÔÏó¡£ </para> <qandaset> <qandaentry id="faq.com.q1"> <question> <para> - I have built a DLL to calculate something. Is there any way to run this DLL under PHP ? + ÎÒ½¨Á¢ÁËÒ»¸ö DLL À´×öijÖÖ¼ÆËã¡£Óа취ÔÚ PHP ÖÐÔËÐÐÕâ¸ö DLL Â𣿠</para> </question> <answer> <para> - If this is a simple DLL there is no way yet to run it from PHP. If the DLL contains a COM - server you may be able to access it if it implements the IDispatch interface. + Èç¹ûÕâÊǸö¼òµ¥µÄ DLL ÄÇô»¹Ã»Óа취ÔÚ PHP ÖÐÔËÐÐËü¡£Èç¹ûÕâ¸ö DLL Öаüº¬ÓÐÒ»¸ö COM + ·þÎñÆ÷²¢ÇÒËüʵÏÖÁË IDispatch ½Ó¿Ú£¬ÄÇÓпÉÄÜ·ÃÎÊËü¡£ </para> </answer> </qandaentry> @@ -28,17 +28,12 @@ <qandaentry id="faq.com.q2"> <question> <para> - What does 'Unsupported variant type: xxxx (0xxxxx)' mean ? + ¡°Unsupported variant type: xxxx (0xxxxx)¡±ÊÇʲôÒâ˼£¿ </para> </question> <answer> <para> - There are dozens of VARIANT types and combinations of them. Most of them are already supported but - a few still have to be implemented. - Arrays are not completely supported. Only single dimensional indexed - only arrays can be passed between PHP and COM. - If you find other types that aren't supported, please report them as a bug (if not already reported) - and provide as much information as available. + Óм¸Ê®ÖÖ VARIANT ÀàÐÍÒÔ¼°ËüÃǵÄ×éºÏ¡£´ó¶àÊýÒѾ±»Ö§³ÖÁ˵«»¹Óм¸ÖÖÉÐδʵÏÖ¡£Êý×éûÓÐÍêÈ«±»Ö§³Ö¡£Ö»ÓÐһάµÄ½öÓÃ×÷Ë÷ÒýµÄÊý×é¿ÉÒÔÔÚ PHP ºÍ COM Ö®¼ä´«µÝ¡£Èç¹ûÄã·¢ÏÖÆäËüδ֧³ÖµÄÀàÐÍ£¬Çëµ±×÷Ò»¸ö bug ±¨¸æ£¨Èç¹ûÉÐδ±»±¨¸æµÄ»°£©²¢Ìṩ¾¡¿ÉÄܶàµÄÐÅÏ¢¡£ </para> </answer> </qandaentry> @@ -46,15 +41,15 @@ <qandaentry id="faq.com.q3"> <question> <para> - Is it possible manipulate visual objects in PHP ? + ÔÚ PHP ÖÐÓпÉÄܲÙ×Ý¿ÉÊÓ¶ÔÏóÂ𣿠</para> </question> <answer> <para> - Generally it is, but as PHP is mostly used as a web scripting language it runs in the web servers context, thus - visual objects will never appear on the servers desktop. - If you use PHP for application scripting e.g. in conjunction with PHP-GTK there is no limitation in accessing and - manipulating visual objects through COM. + Ò»°ãÀ´ËµÊÇ¿ÉÒԵ쬵«ÊÇ PHP ´ó¶¼ÓÃÀ´×÷Ϊ web ½Å±¾ÓïÑÔ²¢ÔËÐÐÔÚ web + ·þÎñÆ÷µÄÉÏÏÂÎÄ»·¾³ÖУ¬Òò´Ë¿ÉÊÓ¶ÔÏó¾ö²»»áÔÚ·þÎñÆ÷µÄ×ÀÃæÉÏÏÔʾ¡£Èç¹ûÄã°Ñ + PHP ÓÃ×÷Ó¦ÓóÌÐò½Å±¾ÀýÈç½áºÏ PHP-GTK À´Ê¹Óã¬ÄÇô·ÃÎʺÍͨ¹ý COM + À´²Ù×Ý¿ÉÊÓ¶ÔÏó·½ÃæÃ»ÓÐÏÞÖÆ¡£ </para> </answer> </qandaentry> @@ -62,12 +57,12 @@ <qandaentry id="faq.com.q4"> <question> <para> - Can I store a COM object in a session ? + ¿ÉÒÔ½«Ò»¸ö COM ¶ÔÏó±£´æÔÚ session ÖÐÂ𣿠</para> </question> <answer> <para> - No, you can't. COM instances are treated as resources and therefore they are only available in a single script's context. + ²»ÐС£COM µÄʵÀý±»¿´×÷ÊÇ×ÊÔ´£¬Òò´ËÖ»ÔÚÒ»¸ö½Å±¾µÄÉÏÏÂÎÄÖÐÓÐЧ¡£ </para> </answer> </qandaentry> @@ -75,13 +70,13 @@ <qandaentry id="faq.com.q5"> <question> <para> - How can I trap COM errors ? + ÔõÑù¿ÉÒÔ²¶»ñ COM µÄ´íÎó£¿ </para> </question> <answer> <para> - Currently it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..), but we are - thinking of a way to implement this. + µ±Ç°³ýÁË PHP ×Ô¼ºÌṩµÄ°ì·¨Ö®Í⣨@£¬track_errors£¬..£©²»¿ÉÄܲ¶»ñ COM + µÄ´íÎ󣬵«ÎÒÃÇÕýÔÚ¿¼ÂÇʵÏÖËüµÄ·½·¨¡£ </para> </answer> </qandaentry> @@ -89,12 +84,12 @@ <qandaentry id="faq.com.q6"> <question> <para> - Can I generate DLL files from PHP scripts like i can in Perl ? + ÎÒÄÜÏñÔÚ Perl ÖÐÒ»Ñù´Ó PHP ½Å±¾Éú³É DLL ÎļþÂ𣿠</para> </question> <answer> <para> - No, unfortunately there is no such tool available for PHP. + ²»ÐУ¬PHP ûÓÐÕâÑùµÄ¹¤¾ß¡£ </para> </answer> </qandaentry> @@ -102,26 +97,26 @@ <qandaentry id="faq.com.q7"> <question> <para> - What does 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' mean ? + ¡°Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}¡±ÊÇʲôÒâ˼£¿ </para> </question> <answer> <para> - This error can have multiple reasons: + ´Ë´íÎó¿ÉÒÔÓжàÖÖÔÒò£º <itemizedlist> <listitem> <simpara> - the CLSID is wrong + ´íÎóµÄ CLSID </simpara> </listitem> <listitem> <simpara> - the requested DLL is missing + ÕÒ²»µ½ËùÇëÇóµÄ DLL </simpara> </listitem> <listitem> <simpara> - the requested component doesn't implement the IDispatch interface + ËùÇëÇóµÄ×é¼þûÓÐʵÏÖ IDispatch ½Ó¿Ú </simpara> </listitem> </itemizedlist> @@ -132,16 +127,15 @@ <qandaentry id="faq.com.q8"> <question> <para> - How can I run COM object from remote server ? + ÔõÑù´ÓÔ¶¶Ë·þÎñÆ÷ÔËÐÐ COM ¶ÔÏó£¿ </para> </question> <answer> <para> - Exactly like you run local objects. You only have to pass the IP of the remote machine as second parameter to - the COM constructor. + ÍêÈ«ºÍÔËÐб¾µØ¶ÔÏóÒ»Ñù¡£Ö»Ð뽫Զ¶Ë·þÎñÆ÷µÄ IP ×÷ΪµÚ¶þ¸ö±äÁ¿´«µÝ¸ø COM µÄ¹¹Ô캯Êý¼´¿É¡£ </para> <para> - Make sure that you have set <literal>com.allow_dcom=true</literal> in your &php.ini;. + È·ÈÏÔÚ &php.ini; ÖÐÉ趨ÁË <literal>com.allow_dcom=true</literal>¡£ </para> </answer> </qandaentry> @@ -149,12 +143,12 @@ <qandaentry id="faq.com.q9"> <question> <para> - I get 'DCOM is disabled in C:\path...\scriptname.php on line 6', what can I do ? + Îҵõ½Ò»¸ö¡°DCOM is disabled in C:\path...\scriptname.php on line 6¡±ÐÅÏ¢£¬Ó¦¸ÃÔõô°ì£¿ </para> </question> <answer> <para> - Edit your &php.ini; and set <literal>com.allow_dcom=true</literal>. + ±à¼ &php.ini; ²¢É趨 <literal>com.allow_dcom=true</literal>¡£ </para> </answer> </qandaentry> @@ -162,14 +156,13 @@ <qandaentry id="faq.com.q10"> <question> <para> - Is it possible to load/manipulate an ActiveX object in a page with PHP ? + ÓпÉÄÜÔÚ PHP Ò³ÃæÖмÓÔØ£¯²Ù×Ý ActiveX ¶ÔÏóÂ𣿠</para> </question> <answer> <para> - This has nothing to do with PHP. ActiveX objects are loaded on client side if they are requested - by the HTML document. There is no relation to the PHP script and therefore there is no direct - server side interaction possible. + Õâ²»¹Ø PHP µÄÊ¡£Èç¹ûÔÚ HTML ÎĵµÖÐÇëÇóµÄ»°£¬ActiveX ¶ÔÏó±»¼ÓÔØÔÚ¿Í»§¶Ë¡£ÕâºÍ PHP + ½Å±¾Ã»ÓйØÏµ£¬Òò´ËÒ²²»¿ÉÄܺͷþÎñÆ÷¶Ë·¢ÉúÖ±½ÓµÄ½»»¥×÷Óᣠ</para> </answer> </qandaentry> @@ -177,20 +170,18 @@ <qandaentry id="faq.com.q11"> <question> <para> - Is it possible to get a running instance of a component ? + ÓпÉÄܵõ½Ò»¸ö×é¼þÔÚÔËÐÐÖеÄʵÀýÂ𣿠</para> </question> <answer> <para> - This is possible with the help of monikers. If you want to get multiple references to the same word instance - you can create that instance like shown: + ÔڴºŵİïÖúÏÂÕâÓпÉÄÜ¡£Èç¹ûÄãÏëµÃµ½Í¬Ò»¸ö word ʵÀýµÄ¶à¸öÒýÓÃÄã¿ÉÒÔÕâÑù½¨Á¢´ËʵÀý£º </para> <programlisting role="php"> $word = new COM("C:\docs\word.doc"); </programlisting> <para> - This will create a new instance if there is no running instance available or it will return a handle to the - running instance, if available. + Èç¹ûûÓÐÔËÐÐÖеÄʵÀýÕ⽫½¨Á¢Ò»¸öеÄʵÀý£¬·ñÔò½«»á·µ»ØÕýÔÚÔËÐÐÖеÄʵÀýµÄ¾ä±ú£¬Èç¹û¿ÉÓõϰ¡£ </para> </answer> </qandaentry> @@ -198,12 +189,12 @@ <qandaentry id="faq.com.q12"> <question> <para> - Is there a way to handle an event sent from COM object ? + Óа취´¦Àí COM ¶ÔÏóÖз¢Ë͵ÄʼþÂ𣿠</para> </question> <answer> <para> - Not yet. + »¹²»ÄÜ¡£ </para> </answer> </qandaentry> @@ -211,14 +202,12 @@ <qandaentry id="faq.com.q13"> <question> <para> - I'm having problems when trying to invoke a method of a COM object - which exposes more than one interface. What can I do ? + ÎÒÔÚ³¢ÊÔµ÷ÓÃÒ»¸ö´ò¿ªÁ˶àÓÚÒ»¸ö½Ó¿ÚµÄ COM ¶ÔÏóÖеķ½·¨Ê±Åöµ½ÎÊÌ⣬Ӧ¸ÃÔõô°ì£¿ </para> </question> <answer> <para> - The answer is as simple as unsatisfying. I don't know exactly but i think you can do nothing. - If someone has specific information about this, please let <ulink url="mailto:&email.harald;">me</ulink> know :) + ÎÒÒ²²»ÖªµÀÔõô°ì£¬ÎÒÏëÕâû°ì·¨¡£Èç¹ûʲôÈËÓжԴËÎÊÌâµÄÃ÷È·ÐÅÏ¢Çë<ulink url="mailto:&email.harald;">¸æËßÎÒ</ulink>¡£:) </para> </answer> </qandaentry> @@ -226,13 +215,12 @@ <qandaentry id="faq.com.q14"> <question> <para> - So PHP works with COM, how about COM+ ? + Õâô˵ PHP ¿ÉÒÔºÍ COM Ò»Æð¹¤×÷£¬ÄÇô COM+ ÄØ£¿ </para> </question> <answer> <para> - COM+ extends COM by a framework for managing components through MTS and MSMQ but there is nothing special that - PHP has to support to use such components. + COM+ ͨ¹ýʹÓà MTS ºÍ MSMQ À´¹ÜÀí×é¼þµÄ¿ò¼ÜÀ©Õ¹ÁË COM£¬µ«²¢Ã»ÓÐÊ²Ã´ÌØÊâÖ®´¦Ê¹ PHP ·ÇÒªÖ§³ÖÕâÑùµÄ×é¼þ¡£ </para> </answer> </qandaentry> @@ -240,16 +228,12 @@ <qandaentry id="faq.com.q15"> <question> <para> - If PHP can manipulate COM objects, can we imagine to use - MTS to manage components resources, in conjunction with PHP ? + Èç¹û PHP ¿ÉÒÔ²Ù×Ý COM ¶ÔÏó£¬ÄÇô¿ÉÒÔÉèÏë½áºÏ PHP Óà MTS À´¹ÜÀí×é¼þ×ÊÔ´Â𣿠</para> </question> <answer> <para> - PHP itself doesn't handle transactions yet. Thus if an error - occurs no rollback is initiated. If you use components that - support transactions you will have to implement the - transaction management yourself. + PHP ±¾Éí»¹²¢²»´¦ÀíÊÂÎñ¡£Òò¶øÈç¹û³ö´íÒ²²»»á·¢¶¯³·»Ø»úÖÆ¡£Èç¹ûÄãʹÓÃÁËÖ§³ÖÊÂÎñ´¦ÀíµÄ×é¼þÄÇÄã²»µÃ²»×Ô¼ºÊµÏÖÊÂÎñ¹ÜÀí¡£ </para> </answer> </qandaentry>