{"id":3038,"date":"2020-09-08T14:17:36","date_gmt":"2020-09-08T06:17:36","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=3038"},"modified":"2026-08-18T12:09:40","modified_gmt":"2026-08-18T04:09:40","slug":"%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f-%e7%ad%96%e7%95%a5%e6%a8%a1%e5%bc%8f%ef%bc%9a%e4%bc%9a%e5%91%98%e4%bb%b7%e6%a0%bc%e4%bd%93%e7%b3%bb%e7%9a%84%e7%ae%80%e5%8d%95%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=3038","title":{"rendered":"\u8bbe\u8ba1\u6a21\u5f0f\u2014\u2014\u7b56\u7565\u6a21\u5f0f\uff1a\u4f1a\u5458\u4ef7\u683c\u4f53\u7cfb\u7684\u7b80\u5355\u5b9e\u73b0"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">\u4eac\u4e1c\u4f1a\u5458\u4f53\u7cfb\u6709\u6ce8\u518c\u3001\u94dc\u724c\u3001\u94f6\u724c\u3001\u9ec4\u91d1\u3001\u94bb\u77f3\u4e94\u6863\uff0c\u4e0d\u540c\u7b49\u7ea7\u4eab\u6709\u4e0d\u540c\u4f18\u60e0\u3002\u7a0b\u5e8f\u91cc\u82e5\u7528\u4e00\u5806 if-else \u786c\u5224\uff0c\u540e\u671f\u5f88\u96be\u7ef4\u62a4\u3002\u66f4\u5408\u9002\u7684\u662f\u8bbe\u8ba1\u6a21\u5f0f\u91cc\u7684<strong style=\"color: #4870ac;\">\u7b56\u7565\u6a21\u5f0f<\/strong>\uff1a\u9488\u5bf9\u4e0d\u540c\u7b49\u7ea7\u4f1a\u5458\uff0c\u6bcf\u4e00\u79cd\u7279\u6743\u5bf9\u5e94\u4e00\u79cd\u4f18\u60e0\u7b56\u7565\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5b9a\u4e49\uff1a\u5b9a\u4e49\u7b97\u6cd5\u7c07\uff0c\u5206\u522b\u5c01\u88c5\u8d77\u6765\uff0c\u8ba9\u5b83\u4eec\u53ef\u4ee5\u4e92\u76f8\u66ff\u6362\uff1b\u6b64\u6a21\u5f0f\u8ba9\u7b97\u6cd5\u7684\u53d8\u5316\u72ec\u7acb\u4e8e\u4f7f\u7528\u7b97\u6cd5\u7684\u5ba2\u6237\u3002\u53c2\u8003\uff1a\u300aHead First \u8bbe\u8ba1\u6a21\u5f0f\u300b\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u524d\u8a00\uff1a\u4f1a\u5458\u4f53\u7cfb<\/h2>\n<p style=\"margin: 1em 0px;\">\u4e0b\u9762\u8fd9\u5f20\u56fe\u662f\u4eac\u4e1c\u5546\u57ce\u7684\u4f1a\u5458\u4f53\u7cfb\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/09\/172010_Fcrk_2249566.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3039\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/09\/172010_Fcrk_2249566.png\" alt=\"172010_Fcrk_2249566\" width=\"955\" height=\"592\" \/><\/a><\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u7b56\u7565\u6a21\u5f0f\u7ed3\u6784<\/h2>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u7ed3\u6784\u539f\u578b<\/h3>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/09\/095925_c5AT_2249566.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3041\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/09\/095925_c5AT_2249566.png\" alt=\"095925_c5AT_2249566\" width=\"840\" height=\"380\" \/><\/a><\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u7ec4\u6210<\/h3>\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u5e94\u7528\u573a\u666f\uff08Context\uff09<\/strong>\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u9700\u8981\u4f7f\u7528 ConcreteStrategy \u63d0\u4f9b\u7684\u7b97\u6cd5\u3002<\/section>\n<\/li>\n<li>\n<section>\u5185\u90e8\u7ef4\u62a4\u4e00\u4e2a Strategy \u7684\u5b9e\u4f8b\u3002<\/section>\n<\/li>\n<li>\n<section>\u8d1f\u8d23\u52a8\u6001\u8bbe\u7f6e\u8fd0\u884c\u65f6 Strategy \u5177\u4f53\u7684\u5b9e\u73b0\u7b97\u6cd5\u3002<\/section>\n<\/li>\n<li>\n<section>\u8d1f\u8d23\u8ddf Strategy \u4e4b\u95f4\u7684\u4ea4\u4e92\u548c\u6570\u636e\u4f20\u9012\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u62bd\u8c61\u7b56\u7565\uff08StrategyInterface\uff09<\/strong>\uff1a\u5b9a\u4e49\u4e00\u4e2a\u516c\u5171\u63a5\u53e3\uff0c\u5404\u79cd\u7b97\u6cd5\u4ee5\u4e0d\u540c\u65b9\u5f0f\u5b9e\u73b0\u8fd9\u4e2a\u63a5\u53e3\uff0cContext \u7528\u5b83\u8c03\u7528\u4e0d\u540c\u7b97\u6cd5\uff0c\u4e00\u822c\u7528\u63a5\u53e3\u6216\u62bd\u8c61\u7c7b\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u5177\u4f53\u7b56\u7565\uff08Strategy\uff09<\/strong>\uff1a\u5305\u88c5\u4e86\u76f8\u5173\u7684\u7b97\u6cd5\u548c\u884c\u4e3a\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u4f1a\u5458\u4ef7\u683c\u573a\u666f<\/h2>\n<p style=\"margin: 1em 0px;\">\u6a21\u4eff\u4eac\u4e1c\uff0c\u5c06\u4f1a\u5458\u5206\u6210\u666e\u901a\u3001\u91d1\u724c\u3001\u94bb\u77f3\u4e09\u6863\u3002\u4e0d\u540c\u7b49\u7ea7\u4f18\u60e0\u7b56\u7565\u5982\u4e0b\uff1a<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u4f18\u60e0\u670d\u52a1\\\u4f1a\u5458\u7b49\u7ea7<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u666e\u901a\u4f1a\u5458<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u9ec4\u91d1\u4f1a\u5458<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u94bb\u77f3\u4f1a\u5458<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4f1a\u5458\u7279\u4ef7<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6b63\u5e38\u4ef7<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6253\u4e5d\u6298<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6253\u4e5d\u6298<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8fd0\u8d39<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">5\u5143<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">5\u5143<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5305\u90ae<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 1em 0px;\">\u4f1a\u5458\u7b56\u7565\u6a21\u578b\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/09\/105153_Vrv1_2249566.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3040\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/09\/105153_Vrv1_2249566.png\" alt=\"105153_Vrv1_2249566\" width=\"823\" height=\"388\" \/><\/a><\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u56db\u3001\u4ee3\u7801\u5b9e\u73b0<\/h2>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u62bd\u8c61\u7b56\u7565\u89d2\u8272<\/h3>\n<p style=\"margin: 1em 0px;\">\u4f1a\u5458\u63a5\u53e3\uff1aMemberInterface.java<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package strategy.member;\n\/**\n * \u4f1a\u5458\u63a5\u53e3\n * @author vision\n *\/\npublic interface MemberInterface {\n\t\/**\n\t * \u4f1a\u5458\u4ef7\u683c\n\t * @param price\n\t * @return\n\t *\/\n\tpublic Double getPrice(Double price);\n\t\/**\n\t * \u662f\u5426\u5305\u90ae\n\t * @return\n\t *\/\n\tpublic boolean freeShipping();\n}<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u5177\u4f53\u7b56\u7565\u89d2\u8272<\/h3>\n<p style=\"margin: 1em 0px;\">\u666e\u901a\u4f1a\u5458\uff1aNormalMember.java<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package strategy.member.impl;\n\nimport strategy.member.MemberInterface;\n\/**\n * \u666e\u901a\u4f1a\u5458\n * @author vision\n *\/\npublic class NormalMember implements MemberInterface{\n\t\/**\n\t * \u4f1a\u5458\u4ef7\u683c\uff0c\u6b63\u5e38\u4ef7\n\t *\/\n\tpublic Double getPrice(Double price) {\n\t\t\/\/\u666e\u901a\u4f1a\u5458\u539f\u4ef7\u9500\u552e\n\t\treturn price;\n\t}\n\t\/**\n\t * \u4e0d\u5305\u90ae\n\t *\/\n\tpublic boolean freeShipping() {\n\t\t\/\/\u666e\u901a\u4f1a\u5458\u4e0d\u5305\u90ae\n\t\treturn false;\n\t}\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u9ec4\u91d1\u4f1a\u5458\uff1aGoldMember.java<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package strategy.member.impl;\n\nimport strategy.member.MemberInterface;\n\/**\n * \u9ec4\u91d1\u4f1a\u5458\n * @author vision\n *\/\npublic class GoldMember implements MemberInterface{\n\t\/**\n\t * \u4f1a\u5458\u4ef7\u683c\uff0c\u6253\u4e5d\u6298\n\t *\/\n\tpublic Double getPrice(Double price) {\n\t\treturn price*0.9;\n\t}\n\t\/**\n\t * \u4e0d\u5305\u90ae\n\t *\/\n\tpublic boolean freeShipping() {\n\t\treturn false;\n\t}\n\t\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u94bb\u77f3\u4f1a\u5458\uff1aDiamondMember.java<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package strategy.member.impl;\n\nimport strategy.member.MemberInterface;\n\/**\n * \u94bb\u77f3\u4f1a\u5458\n * @author vision\n *\/\npublic class DiamondMember implements MemberInterface{\n\t\/**\n\t * \u4f1a\u5458\u4ef7\u683c\uff0c\u6253\u4e5d\u6298\n\t *\/\n\tpublic Double getPrice(Double price) {\n\t\treturn price*0.9;\n\t}\n\t\/**\n\t * \u5305\u90ae\n\t *\/\n\tpublic boolean freeShipping() {\n\t\treturn true;\n\t}\n\n}<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u73af\u5883\u89d2\u8272<\/h3>\n<p style=\"margin: 1em 0px;\">PriceHandle.java<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package strategy;\n\nimport strategy.member.MemberInterface;\nimport strategy.member.impl.DiamondMember;\nimport strategy.member.impl.GoldMember;\nimport strategy.member.impl.NormalMember;\n\/**\n * \u4ef7\u683c\u5904\u7406\u7c7b\n * @author vision\n * @date 2016\u5e7410\u670812\u65e5\n *\/\npublic class PriceHandle {\n\t\n\tprivate MemberInterface memberInterface;\n\n\tpublic void setMemberInterface(MemberInterface memberInterface) {\n\t\tthis.memberInterface = memberInterface;\n\t}\n\n\t\/**\n\t * \u8ba1\u7b97\u51fa\u9700\u8981\u652f\u4ed8\u7684\u8d39\u7528\n\t * @return\n\t *\/\n\tprivate Double getMemberPrice(Double price){\n\t\tDouble postage=5.0;\n\t\tif(memberInterface.freeShipping()){\n\t\t\tpostage=0.0;\n\t\t}\n\t\treturn (memberInterface.getPrice(price)+postage);\n\t}\n}<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u5ba2\u6237\u7aef\u8c03\u7528<\/h3>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public class TestClass{\n\tpublic static void main(String[] args) {\n\t\tPriceHandle priceHandle=new PriceHandle();\n\t\t\/\/\u4f1a\u5458\u7b49\u7ea7\uff080\u666e\u901a\u4f1a\u5458,1\u9ec4\u91d1\u4f1a\u5458,2\u94bb\u77f3\u4f1a\u5458\uff09\n\t\tint memberType=2;\n\t\tswitch (memberType) {\n\t\tcase 0:\n\t\t\tpriceHandle.setMemberInterface(new NormalMember());\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tpriceHandle.setMemberInterface(new GoldMember());\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tpriceHandle.setMemberInterface(new DiamondMember());\n\t\t\tbreak;\n\t\t}\n\t\tSystem.out.println(priceHandle.getMemberPrice(10.0));;\n\t}\n}<\/code><\/pre>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u7b56\u7565\u6a21\u5f0f\u628a\u5404\u6863\u4f1a\u5458\u7684\u8ba1\u4ef7\u548c\u5305\u90ae\u89c4\u5219\u5c01\u88c5\u6210\u53ef\u66ff\u6362\u7b97\u6cd5\uff0cContext \u8fd0\u884c\u65f6\u5207\u6362\u7b56\u7565\uff0c\u907f\u514d\u4e00\u5806 if-else\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u4eac\u4e1c\u4f1a\u5458\u4f53\u7cfb\u6709\u6ce8\u518c\u3001\u94dc\u724c\u3001\u94f6\u724c\u3001\u9ec4\u91d1\u3001\u94bb\u77f3\u4e94\u6863\uff0c\u4e0d\u540c\u7b49\u7ea7\u4eab\u6709\u4e0d\u540c\u4f18\u60e0\u3002\u7a0b\u5e8f\u91cc\u82e5\u7528\u4e00\u5806 if-else \u786c\u5224\uff0c\u540e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,58],"tags":[43,179],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3038"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3038"}],"version-history":[{"count":1,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3038\/revisions"}],"predecessor-version":[{"id":3042,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3038\/revisions\/3042"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}