{"id":49390,"date":"2024-12-02T09:24:45","date_gmt":"2024-12-02T01:24:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49390\/"},"modified":"2024-12-02T09:24:45","modified_gmt":"2024-12-02T01:24:45","slug":"php%e5%a6%82%e4%bd%95%e6%98%be%e7%a4%bahtml%e8%a1%a8%e5%8d%95%e6%8f%90%e4%ba%a4%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49390\/","title":{"rendered":"PHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>PHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f<\/h1>\n<p>\u7c73\u4e91\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aPHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f\u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241201\/1733016829674bbcfd24dae.jpg\" class=\"aligncenter\" title=\"PHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f\u63d2\u56fe\" alt=\"PHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f\u63d2\u56fe\" \/><\/p>\n<p>\u5982\u4f55\u4f7f\u7528php\u5c55\u793ahtml\u8868\u5355\u4e2d\u7684\u5185\u5bb9\uff1f<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u521b\u5efa\u8f93\u5165\u8868\u5355<\/strong><\/p>\n<p>\u5c06\u60a8\u9884\u671f\u7684html\u8868\u5355\u6dfb\u52a0\u5230form\u6807\u7b7e\u5185\uff0c\u5e76\u4f7f\u7528get\u65b9\u6cd5\u5c06\u6570\u636e\u53d1\u9001\u5230php\u811a\u672c\uff1a<\/p>\n<pre>&lt;form action=\"xxx.php\" method=\"get\"&gt;\n  &lt;input type=\"text\" name=\"username\"&gt;\n  &lt;input type=\"submit\"&gt;\n&lt;\/form&gt;<\/pre>\n<p><strong>\u6b65\u9aa4 2\uff1a\u521b\u5efaphp\u811a\u672c<\/strong><\/p>\n<p>\u5728\u540d\u4e3axxx.php\u7684php\u811a\u672c\u4e2d\uff0c\u4f7f\u7528$_get\u8d85\u7ea7\u5168\u5c40\u53d8\u91cf\u83b7\u53d6\u8868\u5355\u6570\u636e\uff1a<\/p>\n<pre>&lt;?php\nif (isset($_get['username'])) {\n  $username = $_get['username'];\n  echo \"\u7528\u6237\u540d\uff1a$username\";\n}\n?&gt;<\/pre>\n<p><strong>\u793a\u4f8b\u8f93\u51fa<\/strong><\/p>\n<p>\u5982\u679c\u4e0d\u8f93\u5165\u4efb\u4f55\u5185\u5bb9\uff0c\u811a\u672c\u5c06\u4e0d\u4f1a\u4ea7\u751f\u8f93\u51fa\u3002\u5982\u679c\u8f93\u5165\u7528\u6237\u540d\u4e3ajohn doe\uff0c\u811a\u672c\u5c06\u8f93\u51fa\uff1a<\/p>\n<pre>\u7528\u6237\u540d\uff1aJohn Doe<\/pre>\n<p><strong>\u5176\u4ed6\u8bf4\u660e<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u9700\u8981\u5904\u7406\u66f4\u591a\u7684\u8868\u5355\u5b57\u6bb5\uff0c\u53ef\u4ee5\u4f7f\u7528if-else\u8bed\u53e5\u6216switch-case\u7ed3\u6784\u3002<\/li>\n<li>\u8bb0\u5f97\u9a8c\u8bc1\u7528\u6237\u4fe1\u606f\u4ee5\u52a0\u5f3a\u5b89\u5168\u6027\u3002<\/li>\n<li>\u4e5f\u53ef\u4ee5\u4f7f\u7528post\u65b9\u6cd5\u4f20\u8f93\u8868\u5355\u6570\u636e\uff0c\u4f46\u8fd9\u9700\u8981\u5728php\u811a\u672c\u7684body\u4e2d\u83b7\u53d6\u6570\u636e\uff08\u8bf7\u53c2\u9605$_post\uff09\u3002<\/li>\n<\/ul>\n<p>\u4eca\u5929\u5173\u4e8e\u300aPHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f \u7c73\u4e91\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u300aPHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f\u300b\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60\u6587\u7ae0\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01 \u5982\u4f55\u4f7f\u7528php\u5c55\u793ahtml\u8868\u5355\u4e2d\u7684\u5185\u5bb9\uff1f \u6b65\u9aa4 1\uff1a\u521b\u5efa\u8f93\u5165\u8868\u5355 \u5c06\u60a8\u9884\u671f\u7684html\u8868\u5355\u6dfb\u52a0\u5230form\u6807\u7b7e\u5185\uff0c\u5e76\u4f7f\u7528get\u65b9\u6cd5\u5c06\u6570\u636e\u53d1\u9001\u5230php\u811a\u672c\uff1a &lt;form action=&#8221;xxx.php&#8221; method=&#8221;get&#8221;&gt; &lt;input type=&#8221;text&#8221; name=&#8221;username&#8221;&gt; &lt;input type=&#8221;submit&#8221;&gt; &lt;\/form&gt; \u6b65\u9aa4 2\uff1a\u521b\u5efaphp\u811a\u672c \u5728\u540d\u4e3axxx.php\u7684php\u811a\u672c\u4e2d\uff0c\u4f7f\u7528$_get\u8d85\u7ea7\u5168\u5c40\u53d8\u91cf\u83b7\u53d6\u8868\u5355\u6570\u636e\uff1a &lt;?php if (isset($_get[&#8216;username&#8217;])) { $username = $_get[&#8216;username&#8217;]; echo &#8220;\u7528\u6237\u540d\uff1a$username&#8221;; } ?&gt; \u793a\u4f8b\u8f93\u51fa \u5982\u679c\u4e0d\u8f93\u5165\u4efb\u4f55\u5185\u5bb9\uff0c\u811a\u672c\u5c06\u4e0d\u4f1a\u4ea7\u751f\u8f93\u51fa\u3002\u5982\u679c\u8f93\u5165\u7528\u6237\u540d\u4e3ajohn doe\uff0c\u811a\u672c\u5c06\u8f93\u51fa\uff1a \u7528\u6237\u540d\uff1aJohn Doe \u5176\u4ed6\u8bf4\u660e \u5982\u679c\u9700\u8981\u5904\u7406\u66f4\u591a\u7684\u8868\u5355\u5b57\u6bb5\uff0c\u53ef\u4ee5\u4f7f\u7528if-else\u8bed\u53e5\u6216switch-case\u7ed3\u6784\u3002 \u8bb0\u5f97\u9a8c\u8bc1\u7528\u6237\u4fe1\u606f\u4ee5\u52a0\u5f3a\u5b89\u5168\u6027\u3002 \u4e5f\u53ef\u4ee5\u4f7f\u7528post\u65b9\u6cd5\u4f20\u8f93\u8868\u5355\u6570\u636e\uff0c\u4f46\u8fd9\u9700\u8981\u5728php\u811a\u672c\u7684body\u4e2d\u83b7\u53d6\u6570\u636e\uff08\u8bf7\u53c2\u9605$_post\uff09\u3002 \u4eca\u5929\u5173\u4e8e\u300aPHP\u5982\u4f55\u663e\u793aHTML\u8868\u5355\u63d0\u4ea4\u7684\u5185\u5bb9\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-49390","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=49390"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49390\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}