{"id":176,"date":"2006-05-23T13:10:37","date_gmt":"2006-05-23T13:10:37","guid":{"rendered":"http:\/\/www.icocean.com\/blog\/?p=176"},"modified":"1970-01-01T07:00:00","modified_gmt":"1970-01-01T07:00:00","slug":"%E5%AE%9E%E4%BE%8B%E5%AD%A6%E4%B9%A0php%E4%B9%8B%E8%A1%A8%E5%8D%95%E5%A4%84%E7%90%86%E7%AF%87","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=176","title":{"rendered":"\u5b9e\u4f8b\u5b66\u4e60PHP\u4e4b\u8868\u5355\u5904\u7406\u7bc7"},"content":{"rendered":"<p>\u5b9e\u4f8b\u5b66\u4e60PHP\u4e4b\u8868\u5355\u5904\u7406\u7bc7<\/p>\n<p>\u5b66\u4e60\u524d\u7684\u51c6\u5907\uff1a \u8981\u60f3\u5b66\u4e60PHP,\u5f53\u7136\u5c11\u4e0d\u4e86\u8981\u5b89\u88c5PHP\u5566\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u662f\u521d\u6b21\u5b66\u4e60\uff0c\u8bf7\u5148\u9605\u8bfb\u661f\u7a7a\u6d6a\u5b50\u5144\u53ca\u5730\u85cf\u7684\uff1a<\/p>\n<p>PHP4.03\u5728linux\u4e0b\u7684\u5b89\u88c5<br \/>PHP4.04\u5728win98\u4e0b\u7684\u5b89\u88c5 <br \/>PHP4.04\u5728\u82f1\u6587win2000\u4e0b\u7684\u5b89\u88c5 <\/p>\n<p>\u5982\u679c\u4f60\u627e\u4e0d\u5230\u5b89\u88c5\u7a0b\u5e8f\u8bf7\u5230\u4e0b\u9762\u4e0b\u8f7d\uff1a<\/p>\n<p>PHP4.04Beta WIN32 \u5b89\u88c5\u7a0b\u5e8f <br \/>PHP4.03\u6e90\u7a0b\u5e8f <br \/>PHP3.0.16 WIN32 \u5b89\u88c5\u7a0b\u5e8f <br \/>PHP3.0.16\u6e90\u7a0b\u5e8f <\/p>\n<p>\u5982\u679c\u4f60\u4ece\u6765\u6ca1\u6709\u63a5\u89e6\u8fc7PHP,\u90a3\u4e48\u8fd8\u662f\u5148\u770b\u770b\u8fd9\u4e2a\u5427\uff0c\u5f53\u7136\u5373\u4f7f\u4f60\u662f\u5df2\u7ecf\u5bf9PHP\u6709\u6240\u4e86\u89e3\uff0c\u4f46\u4e00\u672cPHP4\u7684\u7684\u4f7f\u7528\u624b\u518c\u4e5f\u8fd8\u662f\u9700\u8981\u7684\uff0c\uff1a\uff09\u3002\u6b64\u5916\u4e00\u672cHTML\u8bed\u6cd5\u624b\u518c\u5f53\u7136\u4e5f\u662f\u4e0d\u53ef\u7f3a\u5c11\u7684\u5566\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002<\/p>\n<p>OK!\u73b0\u5728\u5e94\u8be5\u5df2\u7ecf\u6ca1\u6709\u4ec0\u4e48\u53ef\u4ee5\u963b\u6b62\u6211\u4eec\u5b66\u4e60\u4e86\uff0cLet&#39;s go!<\/p>\n<p>\u5728\u5b66\u4e60\u5f00\u59cb\u4ee5\u524d\uff0c\u6211\u4eec\u5148\u4ea4\u5f85\u4e00\u4e0b\u5173\u4e8e\u8868\u5355\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u5982\u679c\u4f60\u5bf9HTML\u975e\u5e38\u719f\u6089\uff0c\u90a3\u4e48\u53ef\u4ee5\u8df3\u8fc7\u8be5\u90e8\u5206\uff0c\u76f4\u63a5\u5b66\u4e60\u3002<\/p>\n<p>\u6545\u540d\u601d\u8bae\u8868\u5355\u662f\u5229\u7528\u7f51\u9875\u6536\u96c6\u6570\u636e\u7684\u5de5\u5177\uff0c\u6bd4\u5982\u4f60\u60f3\u5728\u7f51\u4e0a\u641e\u4e2a\u7fa4\u4f17\u8c03\u67e5\u554a\u4ec0\u4e48\u7684\uff0c\u80af\u5b9a\u662f\u5c11\u4e0d\u4e86\u8981\u7528\u4ed6\u7684\u3002\u4e0b\u9762\u6211\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u8868\u5355\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u5173\u4e8e\u4ed6\u7684\u8be6\u7ec6\u5185\u5bb9\u8bf7\u81ea\u884c\u67e5\u9605HTML\u624b\u518c\u3002<\/p>\n<p>\u8868\u5355\u7684\u4f7f\u7528\u5176\u5b9e\u975e\u5e38\u7b80\u5355,\u5927\u5bb6\u5148\u770b\u4e00\u4e0b\u4e0b\u9762\u7684\u4f8b\u5b50\uff1a<\/p>\n<p>&lt;FORM action=&quot;&lt;?php echo $PHP_SELF; ?&gt;&quot;METHOD=post&gt;<\/p>\n<p>\u540d\u5b57: &lt;INPUT TYPE=TEXT NAME=&quot;name&quot;&gt;&lt;BR&gt;<\/p>\n<p>\u5355\u9879\u9009\u62e9: <\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u5f88\u7b28&quot;&gt;\u6211\u5f88\u7b28<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u975e\u5e38\u7b28&quot;&gt;\u6211\u975e\u5e38\u7b28<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192&quot;&gt; \u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192 &lt;br&gt;<\/p>\n<p>\u591a\u9879\u9009\u62e9: <\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u6253\u84dd\u7403&quot;&gt;\u6211\u559c\u6b22\u6253\u84dd\u7403<\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u6e38\u6cf3&quot;&gt;\u6211\u559c\u6b22\u6e38\u6cf3<\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u8df3\u821e&quot;&gt;\u6211\u559c\u6b22\u8df3\u821e<\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u722c\u5c71&quot;&gt;\u6211\u559c\u6b22\u722c\u5c71<\/p>\n<p>&lt;INPUT TYPE=HIDDEN NAME=&quot;stage&quot; VALUE= &quot;results&quot;&gt;&lt;p&gt;<\/p>\n<p>&lt;INPUT TYPE=SUBMIT VALUE= &quot;\u8c22\u8c22&quot;&gt;&lt;\/p&gt;<\/p>\n<p>&lt;\/FORM&gt;<\/p>\n<p>\u540d\u5b57: <br \/>\u5355\u9879\u9009\u62e9: \u6211\u5f88\u7b28 \u6211\u975e\u5e38\u7b28 \u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192 <br \/>\u591a\u9879\u9009\u62e9: \u6211\u559c\u6b22\u6253\u84dd\u7403 \u6211\u559c\u6b22\u6e38\u6cf3 \u6211\u559c\u6b22\u8df3\u821e \u6211\u559c\u6b22\u722c\u5c71 <\/p>\n<p>\u600e\u4e48\u6837\uff1f\u770b\u660e\u767d\u4e86\u5417\uff1f\u4e0a\u90e8\u5206\u662f\u8868\u5355\u7684html\u6e90\u4ee3\u7801\uff0c\u4e0b\u90e8\u5206\u5219\u662f\u8fd9\u4e2a\u8868\u5355\u5728\u6d4f\u89c8\u5668\u7684\u8868\u73b0\u5f62\u5f0f\u3002 \u6807\u5fd7&lt;FORM action=&quot;&lt;?php echo $PHP_SELF; ?&gt;&quot;METHOD=post&gt; \u8868\u793a\u5f00\u59cb\u4e00\u4e2a\u8868\u5355\uff0c\u5230\u6807\u5fd7&lt;\/Form&gt;\u65f6\u8868\u5355\u7ed3\u675f\u3002\u5904\u7406\u8fd9\u4e2a\u8868\u5355\u7684\u7a0b\u5e8f\uff0c\u7528Form\u6807\u5fd7\u91cc\u7684action\u5c5e\u6027\u6307\u51fa\u3002\u5728\u8fd9\u91cc\u4e3a&lt;? echo $PHP_SELF; ?&gt;, \u5176\u4e2d$PHP_SELF\u662fPHP\u4e2d\u7684\u4e00\u4e2aglobal \u53d8\u91cf\uff0c\u7528\u4e8e\u4fdd\u5b58\u76ee\u524d\u6267\u884c PHP \u7a0b\u5f0f\u9875\u9762\u7684\u6863\u540d\uff0c&lt;? echo $PHP_SELF; ?&gt;\u7684\u610f\u601d\u5c31\u662f\u7528\u5f53\u524d\u7684PHP\u7a0b\u5e8f\u6765\u5904\u7406\u8fd9\u4e2a\u8868\u5355\u3002\u90a3\u4e48\u4e0b\u9762\u7684METHOD=post\u8868\u793a\u4ec0\u4e48\u610f\u601d\u5462\uff1f\u5176\u5b9e\u8868\u5355\u4ece\u6d4f\u89c8\u5668\u53d1\u7ed9\u670d\u52a1\u5668\u6709\u4e24\u79cd\u65b9\u6cd5. GET \u548c POST. GET\u65b9\u6cd5\u5c06\u6570\u636e\u6253\u5305\u653e\u7f6e\u5728\u73af\u5883\u53d8\u91cfQUERY_STRING\u4e2d\u4f5c\u4e3aURL\u6574\u4f53\u7684\u4e00\u90e8\u5206\u4f20\u9012\u7ed9\u670d\u52a1\u5668\u3002 POST\u505a\u5f88\u591a\u7c7b\u4f3cGET\u540c\u6837\u7684\u4e8b\u60c5, \u4e0d\u540c\u7684\u5730\u65b9\u5c31\u662f\u5b83\u662f\u5206\u79bb\u5730\u4f20\u9012\u6570\u636e\u7ed9\u811a\u672c. \u4f60\u7684\u811a\u672c\u901a\u8fc7\u6807\u51c6\u8f93\u5165\u83b7\u53d6\u8fd9\u4e9b\u6570\u636e. QUERY_STRING\u73af\u5883\u53d8\u91cf\u5c06\u4e0d\u518d\u8bbe\u7f6e.\u56e0\u6b64POST\u6709\u66f4\u597d\u7684\u5b89\u5168\u6027\uff0c\u5c24\u5176\u5982\u679c\u4f60\u7684\u8868\u5355\u4e2d\u6709\u5f88\u591a\u6570\u636e\u7684\u8bdd. \u5f53\u4f60\u7528GET, \u8fd9\u4e2a\u670d\u52a1\u5668\u5c31\u5206\u914d\u53d8\u91cfQUERY_STRING\u7ed9\u6240\u6709\u7684\u8868\u5355\u6570\u636e, \u4f46\u662f\u8fd9\u4e2a\u53d8\u91cf\u53ef\u5b58\u50a8\u91cf\u662f\u6709\u9650\u7684. \u6362\u53e5\u8bdd\u8bf4\uff0c\u5982\u679c\u4f60\u6709\u5f88\u591a\u6570\u636e\u4f46\u662f\u4f60\u53c8\u7528GET\uff0c\u4f60\u4f1a\u4e22\u5931\u5f88\u591a\u6570\u636e\u3002 \u5982\u679c\u4f60\u7528POST, \u4f60\u53ef\u4ee5\u5c3d\u53ef\u80fd\u591a\u5730\u4f7f\u7528\u6570\u636e, \u56e0\u4e3a\u8fd9\u4e9b\u6570\u636e\u4ece\u6765\u4e5f\u4e0d\u5206\u914d\u5230\u4e00\u4e2a\u53d8\u91cf\u91cc\u3002\u6b64\u5916\u7528post\u4f20\u9012\u6570\u636e\u8fd8\u6709\u4e00\u4e2a\u597d\u5904\uff0c\u5b83\u4e0d\u4f1a\u8c61get\u90a3\u6837\u628a\u4f60\u4f20\u9001\u7684\u6570\u636e\u66b4\u9732\u5728\u6d4f\u89c8\u5668\u7684\u5730\u5740\u680f\u4e2d\uff0c\u6bd4\u5982\u8c61\u4e0b\u9762\u8fd9\u79cd\uff1aform.php?name=genius&amp;pwd=123456 \uff0c\u660e\u767d\u4e86\u5427\uff1f\u6240\u4ee5\u8fd8\u662f\u7528post\u8ba9\u4eba\u5b89\u5fc3\u4e00\u70b9\u5566\u3002<\/p>\n<p>\u4e0b\u9762\u7ee7\u7eed\u6211\u4eec\u7684\u5b66\u4e60\u5427\uff0c\u5728\u5efa\u7acb\u8868\u5355\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u4e00\u822c\u53ea\u4f1a\u7528\u5230\u4e24\u4e2a\u6807\u5fd7\uff0c\u4e00\u4e2a\u662f\u524d\u9762\u8bf4\u7684&lt;Form&gt;\u6807\u5fd7\uff0c\u8fd8\u6709\u5c31\u662f &lt;Input&gt;\u6807\u5fd7\uff0c\u4e0d\u8981\u5c0f\u770b\u5b83\u54df\uff0c\u8868\u5355\u91cc\u7684\u5404\u79cd\u5c0f\u63a7\u4ef6\u90fd\u662f\u7531\u5b83\u6765\u5efa\u7acb\u7684\u3002\u501f\u52a9\u4e8eInput\u6807\u5fd7\u7684Type\u5c5e\u6027\u53ef\u4ee5\u5b9a\u4e49\u8f93\u5165\u65b9\u6cd5\u7c7b\u578b\uff0c\u6709\u6548\u503c\u4e3aTEXT\uff0cPASSWORD\uff0cRADIO\uff0cCHECKBOX\uff0cSUBMIT\uff0cRESET\uff0cIMAGE\uff0cFILE\uff0cHIDDEN\u548cBUTTON\u3002 \u4e0b\u9762\u662f\u5bf9\u8fd9\u51e0\u4e2a\u8f93\u5165\u7c7b\u578b\u7684\u7b80\u8981\u8bf4\u660e\uff1a<\/p>\n<p>TEXT \u4ea7\u751f\u7b80\u5355\u7684\u5355\u884c\u6587\u672c\u8f93\u5165\u5b57\u6bb5\uff0c\u4e3a\u4e86\u53d6\u5f97\u591a\u884c\u6587\u672c\uff0c\u7528&lt;TEXTAREA&gt;\u6807\u5fd7 <br \/>PASSWORD \u548cTEXT\u4e00\u6837\u4ea7\u751f\u7b80\u5355\u7684\u5355\u884c\u6587\u672c\u8f93\u5165\u5b57\u6bb5\uff0c\u4f46\u4e0d\u4f1a\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u8f93\u5165\u5185\u5bb9 <br \/>RADIO \u4ea7\u751f\u53ef\u5f00\u95ed\u7684\u5c0f\u5355\u9009\u6309\u94ae\uff0c\u591a\u9879\u9009\u62e9\u53ef\u7528CHECKBOX\u578b\u6216\u8005&lt;SELECT&gt;\u6807\u5fd7 <br \/>SUBMIT \u4ea7\u751f\u7528\u4e8e\u5c06\u6240\u6709\u540d\u79f0\u6570\u503c\u5bf9\u63d0\u4ea4\u7ed9\u8868\u5355\u5904\u7406\u7a0b\u5e8f\u7684\u6309\u94ae <br \/>RESET \u7528\u4e8e\u5c06\u6240\u6709\u8f93\u5165\u65b9\u6cd5\u590d\u4f4d\u4e3a\u7a7a\u503c\u6216\u7f3a\u7701\u503c <br \/>IMAGE \u5c06\u63d0\u4ea4\u6309\u94ae\u53d8\u6210\u56fe\u5f62\uff0c\u8fd9\u4e2a\u6570\u503c\u4e0e\u63d0\u4ea4\u6309\u94ae\u4e00\u81f4\uff0c\u53ea\u662f\u9009\u62e9\u56fe\u5f62\u65f6\u9f20\u6807\u4f4d\u7f6ex\u3001y\u5750\u6807\u4e5f\u53d1\u9001\u7ed9\u8868\u5355\u5904\u7406\u7a0b\u5e8f <br \/>BUTTON \u4ea7\u751f\u4e0d\u4e0e\u811a\u672c\u8fdb\u884c\u7279\u5b9a\u4ea4\u4e92\u529f\u80fd\u7684\u6309\u94ae <\/p>\n<p>\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u77e5\u9053\u5982\u4f55\u751f\u6210\u8f93\u5165\u5c0f\u63a7\u4ef6\u4e86\uff0c\u90a3\u4e48\u5728\u8fd9\u4e9b\u63a7\u4ef6\u91cc\u5165\u7684\u6570\u636e\u600e\u4e48\u4f20\u9012\u7ed9\u6211\u4eec\u7684\u7a0b\u5e8f\u6765\u5904\u7406\u5462\uff1f\u5728d \u5728INPUT\u6807\u5fd7\u4e2d\u6709\u4e00\u4e2aNAME\u5c5e\u6027\u4e13\u95e8\u7528\u4e8e\u7ed9\u8f93\u5165\u7684\u6570\u503c\u53d6\u540d\uff0c\u4f8b\u5982\uff1a NAME=&quot;first&quot;\u3002\u5728\u5b9a\u4e49\u4ee5\u540e\uff0c\u5982\u679c\u60f3\u7a0b\u5e8f\u8bbf\u95ee\u8fd9\u4e2a\u6570\u636e\uff0c\u7528global\u7533\u660e\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4f7f\u7528\u55bd\u3002\u5982\u679c\u60f3\u5b9a\u4e49\u6570\u636e\u9ed8\u8ba4\u503c\u7684\u8bdd\uff0c\u53ef\u4ee5\u7528Value\u5c5e\u6027\u5b9a\u4e49\uff0c\u4f8b\u5982\u4e0a\u9762\u7a0b\u5e8f\u7684 VALUE=&quot;\u6211\u5f88\u7b28&quot; \u5c31\u662f\u5b9a\u4e49\u4e86\u4e00\u4e2a\u9ed8\u8ba4\u503c\uff0c\u4e0b\u9762\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u5355\u9879\u9009\u62e9\u7684\u5b9e\u4f8b\uff1a<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u5f88\u7b28&quot;&gt;\u6211\u5f88\u7b28<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u975e\u5e38\u7b28&quot;&gt;\u6211\u975e\u5e38\u7b28<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192&quot;&gt; \u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192 <\/p>\n<p>\u4ece\u4e0a\u9762\u5927\u5bb6\u53ef\u4ee5\u770b\u51faNAME,VALUE\u7684\u57fa\u672c\u7528\u6cd5\u4e86\u5417\uff1f\u4ec0\u4e48\uff1f\u8fd8\u4e0d\u660e\u767d\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\uff08\u5730\u85cf\u6655\u5012\u5728\u5730\u3002\u3002\u3002\u3002)<\/p>\n<p>OK\uff0c\u6211\u4eec\u7684\u8868\u5355\u4f7f\u7528\u5c31\u7b80\u5355\u7684\u8bb2\u5230\u8fd9\u91cc\u5427\uff0c\u5982\u679c\u6709\u6279\u8bc4\u610f\u89c1\uff0c\u6216\u8005\u597d\u7684\u60f3\u6cd5\u8bf7\u4e00\u5b9amail to \u5730\u85cf\uff0c\u4e0b\u9762\u5f00\u59cb\u6211\u4eec\u8fdb\u5165\u6b63\u9898 &#8212;&#8211; PHP\u5904\u7406\u8868\u5355\uff08\u6211\u9760\uff0c\u524d\u9762\u5168\u662f\u5e9f\u8bdd\u5440\uff0c\u7ed9\u6211\u6241\u3002\u3002\u3002\u3002\u3002\uff09<\/p>\n<p>\u7528PHP\u6765\u5904\u7406\u8868\u5355\u6570\u636e\u5b9e\u5728\u662f\u4e00\u4ef6\u975e\u5e38\u7b80\u5355\u7684\u4e8b\u60c5\uff0c\u6253\u4e2a\u6bd4\u65b9\u5c31\u597d\u8c61\u4f60\u5403\u996d\u65f6\u7528\u7b77\u5b50\u4e00\u6837\uff0c\u4f7f\u7528\u975e\u5e38\u7684\u81ea\u7136\uff0c\u6ca1\u6709\u4ec0\u4e48\u9700\u8981\u7279\u522b\u6ce8\u610f\u7684\u5730\u65b9\u3002\u8001\u6837\u5b50\uff0c\u5927\u5bb6\u5f00\u59cb\u5b66\u4e60\u4ee5\u524d\u5148\u770b\u770b\u4e0b\u9762\u7684\u4ee3\u7801\u5427\u3002 &lt;html&gt; <br \/>&lt;head&gt;<\/p>\n<p>&lt;title&gt;\u8c03\u67e5\u8868&lt;\/title&gt;<\/p>\n<p>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=gb2312&quot;&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;<\/p>\n<p>&lt;?php<\/p>\n<p>function display_form() {<\/p>\n<p>global $PHP_SELF;<\/p>\n<p>?&gt;<\/p>\n<p>&lt;FORM action=&quot;&lt;?php echo $PHP_SELF; ?&gt;&quot;METHOD=post&gt;<\/p>\n<p>\u540d\u5b57: &lt;INPUT TYPE=TEXT NAME=&quot;name&quot;&gt;&lt;BR&gt;<\/p>\n<p>\u5355\u9879\u9009\u62e9: <\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u5f88\u7b28&quot;&gt;\u6211\u5f88\u7b28<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u975e\u5e38\u7b28&quot;&gt;\u6211\u975e\u5e38\u7b28<\/p>\n<p>&lt;INPUT TYPE=RADIO NAME=&quot;first&quot; VALUE=&quot;\u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192&quot;&gt; \u6211\u7b80\u76f4\u5c31\u662f\u4e2a\u50bb\u5192 &lt;br&gt;<\/p>\n<p>\u591a\u9879\u9009\u62e9: <\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u6253\u84dd\u7403&quot;&gt;\u6211\u559c\u6b22\u6253\u84dd\u7403<\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u6e38\u6cf3&quot;&gt;\u6211\u559c\u6b22\u6e38\u6cf3<\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u8df3\u821e&quot;&gt;\u6211\u559c\u6b22\u8df3\u821e<\/p>\n<p>&lt;INPUT TYPE=CHECKBOX NAME=&quot;second[]&quot; VALUE=&quot;\u6211\u559c\u6b22\u722c\u5c71&quot;&gt;\u6211\u559c\u6b22\u722c\u5c71<\/p>\n<p>&lt;INPUT TYPE=HIDDEN NAME=&quot;stage&quot; VALUE= &quot;results&quot;&gt;&lt;p&gt;<\/p>\n<p>&lt;INPUT TYPE=SUBMIT VALUE= &quot;\u8c22\u8c22&quot;&gt;&lt;\/p&gt;<\/p>\n<p>&lt;\/FORM&gt;<\/p>\n<p>&lt;?php<\/p>\n<p>}<\/p>\n<p>?&gt;<\/p>\n<p>\/\/\u7a0b\u5e8f\u5f00\u59cb<\/p>\n<p>&lt;?php<\/p>\n<p>function process_form()<\/p>\n<p>{<\/p>\n<p>global $name ;<\/p>\n<p>global $first;<\/p>\n<p>global $second; <\/p>\n<p>if ($first == &#39;\u6211\u5f88\u7b28&#39;) { $first_message = &#39;\u4f60\u4e0d\u7b28\u3002&#39;; }<\/p>\n<p>elseif ($first == &#39;\u6211\u975e\u5e38\u7b28&#39;) { $first_message = &#39;\u4f60\u5f88\u806a\u660e\u3002&#39;; }<\/p>\n<p>else { $first_message = &#39;\u4f60\u7b80\u76f4\u5c31\u8c61\u662f\u4e00\u4e2a\u806a\u660e\u7684\u4eba\u4e86\u3002&#39;; } <\/p>\n<p>$favorite_second = count($second); <\/p>\n<p>if ($favorite_second &lt;= 1) <\/p>\n<p>{$second_message = &#39;\u4f46\u4f60\u5f88\u5feb\u5c31\u4f1a\u5728\u52a8\u7269\u56ed\u91cc\u6b7b\u53bb\uff0c\u5fcf\u6094\u5427\uff01&#39;;} <\/p>\n<p>elseif ($favorite_second &gt; 1 &amp;&amp; $favorite_second &lt; 4) <\/p>\n<p>{$second_message = &#39;\u4f60\u662f\u53ea\u7231\u8fd0\u52a8\u7684\u7684\u7329\u7329\u3002&#39;;} <\/p>\n<p>else {$second_message = &#39;\u4f60\u8fd0\u52a8\u7684\u592a\u591a\u4e86\uff0c\u5bf9\u7329\u7329\u6765\u8bb2\u5df2\u7ecf\u8fc7\u91cf\uff0c\u4f60\u51c6\u5907\u68fa\u6750\u5427\uff0c\uff1a\uff08&#39;;} <\/p>\n<p>echo &quot;\u8fd9\u662f\u4e00\u9879\u9488\u5bf9\u7329\u7329\u7684\u6d4b\u8bd5\uff1a&lt;br&gt;&lt;br&gt;&quot;; <\/p>\n<p>echo &quot;\u4f60\u597d\uff01 \u4f60\u7684\u540d\u5b57\u53eb\uff1a$name. &lt;br&gt;&lt;br&gt;&quot;;<\/p>\n<p>echo &quot;\u4f60\u7684\u6d4b\u9a8c\u7ed3\u679c\u662f\u3002\u3002\u3002\u3002\u3002$first_message $second_message&quot;; <\/p>\n<p>} <\/p>\n<p>?&gt; <\/p>\n<p>&lt;?php <\/p>\n<p>if (empty($stage)) { display_form(); }<\/p>\n<p>else { process_form(); }<\/p>\n<p>?&gt; <\/p>\n<p>&lt;\/body&gt; <\/p>\n<p>&lt;\/html&gt; <\/p>\n<p>\u4e0a\u9762\u662f\u4e00\u4e2a\u975e\u5e38\u7c7b\u4f3c\u8c03\u67e5\u8868\u7684PHP\u4f8b\u5b50\uff0c\u7531\u4e8e\u7a0b\u5e8f\u6bd4\u8f83\u7b80\u5355\uff0c\u6240\u4ee5\u6ca1\u6709\u505a\u4ec0\u4e48\u6ce8\u89e3\u3002\u7a0b\u5e8f\u7684\u539f\u578b\u6765\u81eaPHP\u5b9e\u9a8c\u5ba4\u3002\u5927\u5bb6\u5728\u4ed4\u7ec6\u770b\u7a0b\u5e8f\u4e4b\u524d\u53ef\u4ee5\u628a\u8fd9\u6bb5\u4ee3\u7801\u62f7\u4e0b\u6765\u5728\u81ea\u5df1\u673a\u5668\u8fd0\u884c\u4e00\u4e0b\u5148\u770b\u770b\u5b9e\u9645\u6548\u679c\uff0c\u8fd9\u6837\u6709\u4e00\u4e2a\u76f4\u89c2\u7684\u5370\u8c61\u3002<\/p>\n<p>\u5728\u770b\u5b8c\u4ee3\u7801\u4e4b\u540e\uff0c\u5927\u5bb6\u6ca1\u6709\u4ec0\u4e48\u95ee\u9898\u5427\uff1fOK,\u6211\u4eec\u4e0b\u8bfe\u3002\uff08\u661f\u7a7a\u6d6a\u5b50\uff1a\u9760\uff0c\u5982\u679c\u5c31\u8fd9\u6837\u4f60\u5199\u4e86\u4ec0\u4e48\u5440\u3002\uff09\u5730\u85cf\u9053\uff1a&quot;\u6211\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002\u3002&quot;<\/p>\n<p>\u54b3\uff0c\u5404\u4f4d\u5144\u5f1f\uff0c\u5730\u85cf\u7684\u4e1c\u897f\u5199\u5f97\u4e0d\u597d\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u6307\u70b9\uff01\u7ed9\u5730\u85cf\u5199\u4fe1\u54df\u3002\u3002\u3002\u3002\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9e\u4f8b\u5b66\u4e60PHP\u4e4b\u8868\u5355\u5904\u7406\u7bc7 \u5b66\u4e60\u524d\u7684\u51c6\u5907\uff1a \u8981\u60f3\u5b66\u4e60PHP,\u5f53\u7136\u5c11\u4e0d\u4e86\u8981\u5b89\u88c5PHP\u5566\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u662f\u521d\u6b21\u5b66\u4e60\uff0c\u8bf7 <a href='https:\/\/www.icocean.com\/blog\/?p=176' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-4","category-4-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176"}],"version-history":[{"count":0,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}