{"id":12123,"date":"2018-11-30T00:00:00","date_gmt":"2018-11-29T16:00:00","guid":{"rendered":"https:\/\/fgchen.com\/wpedu2\/2018\/11\/30\/%e3%80%90php%e3%80%9120181130%e8%aa%b2%e5%a0%82%e7%b7%b4%e7%bf%92%e5%8f%83%e8%80%83%e7%ad%94%e6%a1%88\/"},"modified":"2026-03-30T14:41:34","modified_gmt":"2026-03-30T06:41:34","slug":"%e3%80%90php%e3%80%9120181130%e8%aa%b2%e5%a0%82%e7%b7%b4%e7%bf%92%e5%8f%83%e8%80%83%e7%ad%94%e6%a1%88","status":"publish","type":"post","link":"https:\/\/fgchen.com\/wpedu\/2018\/11\/%e3%80%90php%e3%80%9120181130%e8%aa%b2%e5%a0%82%e7%b7%b4%e7%bf%92%e5%8f%83%e8%80%83%e7%ad%94%e6%a1%88\/","title":{"rendered":"\u3010PHP\u301120181130\u8ab2\u5802\u7df4\u7fd2\u53c3\u8003\u7b54\u6848"},"content":{"rendered":"<ul>\n    <li>\n<h3>\u88fd\u4f5c\u4e00\u500b\u8f38\u5165\u65b9\u584a\uff0c\u9650\u5236\u8f38\u51651~7\uff0c\u8f38\u51fa\u5c0d\u61c9\u661f\u671f\u7684\u82f1\u6587\uff1aMon, Tue, Wed, Thu, Fri, Sat, Sun<\/h3>\n<\/li>\n<\/ul>\n\n[code language=&#8221;php&#8221;]\n&lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;\n  \u8f38\u5165\u661f\u671f\u6578\u5b57(1~7)  :   &lt;input type=&quot;text&quot; name=&quot;a&quot;&gt;;\n  &lt;input type=&quot;submit&quot; value=&quot;\u9001\u51fa&quot; name=&quot;submit_btn&quot;&gt;;\n&lt;\/form&gt;\n&lt;?php\n    if(isset($_REQUEST[&#8216;submit_btn&#8217;]))\n    {\n      $weekDay = array(&#8221;, &#8216;Mon&#8217;, &#8216;Tue&#8217;, &#8216;Wed&#8217;, &#8216;Thu&#8217;, &#8216;Fri&#8217;, &#8216;Sat&#8217;, &#8216;Sun&#8217;);\n      $a = $_POST[&quot;a&quot;];\n      if ($a &lt; 1 || $a &gt;; 7) {\n        echo &quot;\u8f38\u5165\u932f\u8aa4\uff01\u53ea\u63a5\u53d71~7\u7684\u6578\u5b57\uff01&quot;;\n        exit();\n      }\n      echo &quot;&lt;H1&gt;;&quot;.$weekDay[$a].&quot;&lt;\/H1&gt;&quot;;\n    }\n?&gt;\n[\/code]\n\n<ul>\n    <li>\n<h3>\u88fd\u4f5c\u4e00\u500b\u8f38\u5165\u65b9\u584a\uff0c\u9650\u5236\u8f38\u51651~12\uff0c\u8f38\u51fa\u5c0d\u61c9\u6708\u4efd\u7684\u82f1\u6587\uff1aJanuary, February, March, April, May, June, July, August, September, October, November, December\u3002(\u8acb\u53c3\u8003\u4e0a\u984c\u3002)<\/h3>\n<\/li>\n    <li>\n<h3>\u8f38\u5165\u6708\u4efd\u7684\u82f1\u6587\uff1aJanuary, February, March, April, May, June, July, August, September, October, November, December\uff0c\u8f38\u51fa\u5176\u4ee3\u8868\u7684\u5e7e\u6708\u3002<\/h3>\n<\/li>\n<\/ul>\n\n[code language=&#8221;php&#8221;]\n&lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;\n  \u8f38\u5165\u6708\u4efd\u7684\u82f1\u6587\u540d\u7a31(January,&#8230; )  :   &lt;input type=&quot;text&quot; name=&quot;month&quot;&gt;\n  &lt;input type=&quot;submit&quot; value=&quot;\u9001\u51fa&quot; name=&quot;submit_btn&quot;&gt;\n&lt;\/form&gt;\n&lt;?php\n  if(isset($_REQUEST[&#8216;submit_btn&#8217;])) {\n    $mt = array(&#8216;January&#8217;=&gt;1, &#8216;February&#8217;=&gt;2, &#8216;March&#8217;=&gt;3,\n                &#8216;April&#8217;=&gt;4, &#8216;May&#8217;=&gt;5, &#8216;June&#8217;=&gt;6,\n                &#8216;July&#8217;=&gt;7, &#8216;August&#8217;=&gt;8, &#8216;September&#8217;=&gt;9,\n                &#8216;October&#8217;=&gt;10, &#8216;November&#8217;=&gt;11, &#8216;December&#8217;=&gt;12);\n    $month = $_POST[&quot;month&quot;];\n    $month[0] = strtoupper($month[0]);\n    echo &quot;\u4f60\u8f38\u5165\u7684\u6708\u4efd\u82f1\u6587\u540d\u7a31\u662f\uff1a&quot;.$month;\n    echo &quot;\u5176\u6708\u4efd\u6578\u5b57\u70ba\uff1a&quot;.$mt[$month];\n  }\n?&gt;\n[\/code]\n\n<ul>\n    <li>\n<h3>\u8f38\u5165\u8eab\u4efd\u8b49\u5b57\u865f(\u5b57\u4e32)\uff0c\u7531\u7b2c1\u500b\u5b57\u5143\u6839\u64da\u4e0b\u8868\u8f38\u51fa\u51fa\u751f\u5730\uff1a<\/h3>\n<\/li>\n<\/ul>\n\n<table style=\"border-collapse: collapse;width: 59.9772%\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 20.4664%\">A=10 \u53f0\u5317\u5e02<\/td>\n<td style=\"width: 22.8684%\">J=18 \u65b0\u7af9\u7e23<\/td>\n<td style=\"width: 18.0579%\">S=26 \u9ad8\u96c4\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">B=11 \u53f0\u4e2d\u5e02<\/td>\n<td style=\"width: 22.8684%\">K=19 \u82d7\u6817\u7e23<\/td>\n<td style=\"width: 18.0579%\">T=27 \u5c4f\u6771\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">C=12 \u57fa\u9686\u5e02<\/td>\n<td style=\"width: 22.8684%\">L=20 \u53f0\u4e2d\u7e23<\/td>\n<td style=\"width: 18.0579%\">U=28 \u82b1\u84ee\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">D=13 \u53f0\u5357\u5e02<\/td>\n<td style=\"width: 22.8684%\">M=21 \u5357\u6295\u7e23<\/td>\n<td style=\"width: 18.0579%\">V=29 \u53f0\u6771\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">E=14 \u9ad8\u96c4\u5e02<\/td>\n<td style=\"width: 22.8684%\">N=22 \u5f70\u5316\u7e23<\/td>\n<td style=\"width: 18.0579%\">W=32 \u91d1\u9580\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">F=15 \u53f0\u5317\u7e23<\/td>\n<td style=\"width: 22.8684%\">O=35 \u65b0\u7af9\u5e02<\/td>\n<td style=\"width: 18.0579%\">X=30 \u6f8e\u6e56\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">G=16 \u5b9c\u862d\u7e23<\/td>\n<td style=\"width: 22.8684%\">P=23 \u96f2\u6797\u7e23<\/td>\n<td style=\"width: 18.0579%\">Y=31 \u967d\u660e\u5c71<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">H=17 \u6843\u5712\u7e23<\/td>\n<td style=\"width: 22.8684%\">Q=24 \u5609\u7fa9\u7e23<\/td>\n<td style=\"width: 18.0579%\">Z=33 \u9023\u6c5f\u7e23<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 20.4664%\">I=34 \u5609\u7fa9\u5e02<\/td>\n<td style=\"width: 22.8684%\">R=25 \u53f0\u5357\u7e23<\/td>\n<td style=\"width: 18.0579%\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n[code language=&#8221;php&#8221;]\n&lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;\n  \u8f38\u5165\u8eab\u4efd\u8b49\u5b57\u865f  :   &lt;input type=&quot;text&quot; name=&quot;id&quot;&gt;\n  &lt;input type=&quot;submit&quot; value=&quot;\u9001\u51fa&quot; name=&quot;submit_btn&quot;&gt;\n&lt;\/form&gt;\n&lt;?php\n  if(isset($_REQUEST[&#8216;submit_btn&#8217;])) {\n    $id_city = array(&#8216;\u53f0\u5317\u5e02&#8217;, &#8216;\u53f0\u4e2d\u5e02&#8217;, &#8216;\u57fa\u9686\u5e02&#8217;,\n                     &#8216;\u53f0\u5357\u5e02&#8217;, &#8216;\u9ad8\u96c4\u5e02&#8217;, &#8216;\u53f0\u5317\u7e23&#8217;,\n                     &#8216;\u5b9c\u862d\u7e23&#8217;, &#8216;\u6843\u5712\u7e23&#8217;, &#8216;\u65b0\u7af9\u7e23&#8217;,\n                     &#8216;\u82d7\u6817\u7e23&#8217;, &#8216;\u53f0\u4e2d\u7e23&#8217;, &#8216;\u5357\u6295\u7e23&#8217;,\n                     &#8216;\u5f70\u5316\u7e23&#8217;, &#8216;\u96f2\u6797\u7e23&#8217;, &#8216;\u5609\u7fa9\u7e23&#8217;,\n                     &#8216;\u53f0\u5357\u7e23&#8217;, &#8216;\u9ad8\u96c4\u7e23&#8217;, &#8216;\u5c4f\u6771\u7e23&#8217;,\n                     &#8216;\u82b1\u84ee\u7e23&#8217;, &#8216;\u53f0\u6771\u7e23&#8217;, &#8216;\u6f8e\u6e56\u7e23&#8217;,\n                     &#8216;\u967d\u660e\u5c71&#8217;, &#8216;\u91d1\u9580\u7e23&#8217;, &#8216;\u9023\u6c5f\u7e23 &#8216;,\n                     &#8216;\u5609\u7fa9\u5e02&#8217;, &#8216;\u65b0\u7af9\u5e02&#8217;);\n    $id_city_1 = array(&#8216;A&#8217; =&gt; &#8216;\u53f0\u5317\u5e02&#8217;, &#8216;B&#8217; =&gt; &#8216;\u53f0\u4e2d\u5e02&#8217;,\n                       &#8216;C&#8217; =&gt; &#8216;\u57fa\u9686\u5e02&#8217;,  &#8216;D&#8217; =&gt; &#8216;\u53f0\u5357\u5e02&#8217;,\n                       &#8216;E&#8217; =&gt; &#8216;\u9ad8\u96c4\u5e02&#8217;, &#8216;F&#8217; =&gt; &#8216;\u53f0\u5317\u7e23&#8217;);\n                       \/\/\u53ea\u5beb\u524d\u9762\u5e7e\u500b\uff0c\u5b8c\u6574\u7684\uff0c\u8acb\u81ea\u884c\u52a0\u5165\n    $id = $_POST[&quot;id&quot;]; \/\/\u5f9e\u8f38\u5165\u65b9\u584a\u53d6\u503c\uff0c\u6307\u5b9a\u7d66\u8b8a\u6578$id\n    $id = trim($id); \/\/\u9664\u53bb\u8f38\u5165\u8eab\u4efd\u8b49(\u5b57\u4e32)\u7684\u7a7a\u767d\n    echo $id.&#8217;&#8230;..&#8217;;\n    \/\/\u5c07\u7b2c\u4e00\u500b\u5b57\u5143\u8f49\u5927\u5beb\n    $id[0]= strtoupper($id[0]);\n    echo &quot;\u4f60\u8eab\u4efd\u8b49\u5b57\u865f\u7b2c1\u500b\u5b57\uff1a&quot;.$id[0].&quot;&lt;br&gt;&quot;;\n    \/\/\u7b2c\u4e00\u7a2e\u65b9\u5f0f\uff0c\u7528\u6574\u6578\u7d22\u5f15\u7684\u65b9\u5f0f\n    echo &quot;\u4f60\u7684\u51fa\u8eab\u5730\u662f\uff1a&quot;.$id_city[ord($id[0])-65].&quot;(\u6574\u6578\u7d22\u5f15)&lt;br&gt;&quot;;\n    \/\/\u7b2c\u4e8c\u7a2e\u7a2e\u65b9\u5f0f\uff0c\u7528\u95dc\u9023\u9663\u5217\u7d22\u5f15\u7684\u65b9\u5f0f\n    echo &quot;\u4f60\u7684\u51fa\u8eab\u5730\u662f\uff1a&quot;.$id_city_1[$id[0]].&quot;(\u95dc\u9023\u9663\u5217\u7d22\u5f15)&lt;br&gt;&quot;;\n  }\n?&gt;\n[\/code]\n\u5c07\u5206\u6578\u5206\u7d1a\u7a0b\u5f0f\u4ee5\u9663\u5217\u65b9\u5f0f\u6539\u5beb\uff1a\n[code language=&#8221;php&#8221;]\n&lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;\n  \u8acb\u8f38\u5165\u4f60\u7684\u6210\u7e3e :   &lt;input type=&quot;text&quot; name=&quot;score&quot;&gt;\n  &lt;input type=&quot;submit&quot; value=&quot;\u9001\u51fa&quot; name=&quot;submit_btn&quot;&gt;\n&lt;\/form&gt;\n&lt;?php\n    $grade = array(&#8216;E&#8217;, &#8216;E&#8217;, &#8216;E&#8217;, &#8216;E&#8217;, &#8216;E&#8217;, &#8216;E&#8217;, &#8216;D&#8217;, &#8216;C&#8217;, &#8216;B&#8217;, &#8216;A&#8217;, &#8216;A+&#8217;);\n    if(isset($_REQUEST[&#8216;submit_btn&#8217;]))\n    {\n       $score = $_POST[&quot;score&quot;];\n       if (! is_numeric($score)) {\n         echo &quot;\u8acb\u8f38\u5165\u6578\u503c\uff01&quot;;\n         exit();\n       }\n       if ($score &lt;= 100 &amp;amp;amp;amp;&amp;amp;amp;amp; $score &gt;= 0){\n         $s = (int)($score \/ 10);\n         echo $grade[$s];\n       }\n       else echo &quot;\u8f38\u5165\u7684\u503c $score \u662f\u932f\u7684\uff0c\u5fc5\u9808\u57280~100\u4e4b\u9593&quot;;\n    }\n?&gt;\n[\/code]","protected":false},"excerpt":{"rendered":"<p>\u88fd\u4f5c\u4e00\u500b\u8f38\u5165\u65b9\u584a\uff0c\u9650\u5236\u8f38\u51651~7\uff0c\u8f38\u51fa\u5c0d\u61c9\u661f\u671f\u7684\u82f1\u6587\uff1aMon, Tue, Wed &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[266],"tags":[],"class_list":["post-12123","post","type-post","status-publish","format-standard","hentry","category-266"],"_links":{"self":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/comments?post=12123"}],"version-history":[{"count":1,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12123\/revisions"}],"predecessor-version":[{"id":13323,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12123\/revisions\/13323"}],"wp:attachment":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/media?parent=12123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/categories?post=12123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/tags?post=12123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}