{"id":180486,"date":"2024-05-08T20:36:14","date_gmt":"2024-05-08T12:36:14","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/180486.html"},"modified":"2024-05-08T20:36:20","modified_gmt":"2024-05-08T12:36:20","slug":"%e5%85%b3%e4%ba%8er%e8%af%ad%e8%a8%80%e7%9a%84%e5%8c%b9%e9%85%8d%ef%bc%8c%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8merge-if%e7%9a%84%e5%88%a4%e5%88%ab","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/180486.html","title":{"rendered":"\u5173\u4e8eR\u8bed\u8a00\u7684\u5339\u914d\uff0c\u5982\u4f55\u4f7f\u7528merge if\u7684\u5224\u522b"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27065659\/e9b8590d-beaf-437a-942a-255f9af1f3ba.webp\" alt=\"\u5173\u4e8eR\u8bed\u8a00\u7684\u5339\u914d\uff0c\u5982\u4f55\u4f7f\u7528merge if\u7684\u5224\u522b\" \/><\/p>\n<p><p>\u5173\u4e8eR\u8bed\u8a00\u4e2d\u7684\u5339\u914d\uff0c<strong>\u4f7f\u7528<code>merge()<\/code>\u51fd\u6570\u7ed3\u5408<code>if<\/code>\u8bed\u53e5\u7684\u5224\u522b<\/strong>\u53ef\u4ee5\u6709\u6548\u5730\u8fdb\u884c\u6570\u636e\u6846\u7684\u5408\u5e76\u3001\u5173\u952e\u5217\u7684\u5339\u914d\u548c\u6761\u4ef6\u7b5b\u9009\u3002\u5177\u4f53\u5730\uff0c<code>merge()<\/code>\u51fd\u6570\u53ef\u4ee5\u6839\u636e\u4e00\u4e2a\u6216\u591a\u4e2a\u5171\u6709\u5217\u628a\u4e24\u4e2a\u6570\u636e\u96c6\u5408\u5e76\u5728\u4e00\u8d77\uff0c\u800c<code>if<\/code>\u8bed\u53e5\u53ef\u4ee5\u5728\u5408\u5e76\u7ec6\u8282\u4e0a\u63d0\u4f9b\u66f4\u591a\u7684\u63a7\u5236\uff0c\u6bd4\u5982\u4ec5\u5408\u5e76\u7279\u5b9a\u6761\u4ef6\u6ee1\u8db3\u7684\u884c\u3002<\/p>\n<\/p>\n<p><p>\u8981\u6709\u6548\u4f7f\u7528<code>merge()<\/code>\u548c<code>if<\/code>\u7ed3\u5408\u8fdb\u884c\u6570\u636e\u5339\u914d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5408\u5e76\u7684\u6570\u636e\u6846\u62e5\u6709\u5171\u6709\u5217\uff0c\u8fd9\u4e9b\u5217\u7684\u540d\u79f0\u548c\u5185\u5bb9\u4f1a\u88ab\u7528\u6765\u5339\u914d\u5408\u5e76\u3002\u63a5\u7740\uff0c\u901a\u8fc7<code>if<\/code>\u8bed\u53e5\u5bf9\u5408\u5e76\u6761\u4ef6\u8fdb\u884c\u7ea6\u675f\uff0c\u53ef\u4ee5\u5224\u65ad\u662f\u5426\u9700\u8981\u6267\u884c\u5408\u5e76\u64cd\u4f5c\u6216\u8005\u662f\u5426\u5408\u5e76\u7279\u5b9a\u5b50\u96c6\u7684\u6570\u636e\u3002\u6b64\u5916\uff0c<code>merge()<\/code>\u7684\u53c2\u6570\u5982<code>all<\/code>\u3001<code>all.x<\/code>\u3001<code>all.y<\/code>\u53ef\u4ee5\u7528\u6765\u6307\u5b9a\u662f\u8981\u6267\u884c\u5185\u8fde\u63a5\u3001\u5de6\u8fde\u63a5\u3001\u53f3\u8fde\u63a5\u8fd8\u662f\u5168\u8fde\u63a5\u3002\u7ed3\u5408<code>if<\/code>\u6761\u4ef6\u5224\u522b\uff0c\u53ef\u4ee5\u7b5b\u9009\u51fa\u60f3\u8981\u5408\u5e76\u7684\u6570\u636e\uff0c\u5bf9\u5904\u7406\u590d\u6742\u7684\u6570\u636e\u5173\u7cfb\u6709\u6781\u5927\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001MERGE\u51fd\u6570\u7684\u57fa\u672c\u7528\u6cd5<\/h3>\n<\/p>\n<p><p><strong>merge()\u51fd\u6570<\/strong>\u662fR\u8bed\u8a00\u4e2d\u4e00\u4e2a\u7528\u4e8e\u5408\u5e76\u4e24\u4e2a\u6570\u636e\u6846\uff08data.frames\uff09\u7684\u5f3a\u5927\u5de5\u5177\u3002\u5b83\u53ef\u4ee5\u6839\u636e\u4e00\u4e2a\u6216\u591a\u4e2a\u5171\u6709\u7684\u5217\uff08\u952e\u503c\uff09\u6765\u8054\u5408\u6570\u636e\u6846\u3002\u57fa\u672c\u7684\u7528\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-R\">merged_data &lt;- merge(x, y, by = &quot;common_column&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc<code>x<\/code>\u548c<code>y<\/code>\u662f\u8981\u5408\u5e76\u7684\u4e24\u4e2a\u6570\u636e\u6846\uff0c<code>by<\/code>\u662f\u6307\u5b9a\u7684\u516c\u5171\u5217\u540d\u3002\u5982\u679c\u6570\u636e\u6846\u4e2d\u6709\u591a\u5217\u4f5c\u4e3a\u952e\u503c\u8fdb\u884c\u5339\u914d\uff0c\u53ef\u4ee5\u8fd9\u6837\u4f7f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-R\">merged_data &lt;- merge(x, y, by = c(&quot;common_column1&quot;, &quot;common_column2&quot;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code>merge()<\/code>\u6267\u884c\u7684\u662f\u5185\u8fde\u63a5\uff0c\u5373\u53ea\u6709\u5728\u4e24\u4e2a\u6570\u636e\u6846\u4e2d\u90fd\u5b58\u5728\u7684\u952e\u503c\u7684\u884c\u624d\u4f1a\u51fa\u73b0\u5728\u7ed3\u679c\u4e2d\u3002\u82e5\u8981\u5728\u5408\u5e76\u65f6\u5305\u542b\u4e00\u4e2a\u6216\u4e24\u4e2a\u6570\u636e\u6846\u7684\u6240\u6709\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>all<\/code>\u3001<code>all.x<\/code>\u6216\u8005<code>all.y<\/code>\u53c2\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-R\"># \u5de6\u8fde\u63a5<\/p>\n<p>merged_data &lt;- merge(x, y, by = &quot;common_column&quot;, all.x = TRUE)<\/p>\n<h2><strong>\u53f3\u8fde\u63a5<\/strong><\/h2>\n<p>merged_data &lt;- merge(y, x, by = &quot;common_column&quot;, all.y = TRUE)<\/p>\n<h2><strong>\u5168\u8fde\u63a5<\/strong><\/h2>\n<p>merged_data &lt;- merge(x, y, by = &quot;common_column&quot;, all = TRUE)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001IF\u8bed\u53e5\u7684\u4f5c\u7528\u4e0e\u7ed3\u5408MERGE\u4f7f\u7528<\/h3>\n<\/p>\n<p><p><strong>if\u8bed\u53e5<\/strong>\u5728R\u8bed\u8a00\u4e2d\u7528\u4e8e\u57fa\u4e8e\u6761\u4ef6\u6267\u884c\u76f8\u5e94\u7684\u4ee3\u7801\u5757\u3002\u5f53\u9700\u8981\u5728\u5408\u5e76\u6570\u636e\u4e4b\u524d\u5bf9\u6570\u636e\u8fdb\u884c\u7b5b\u9009\u6216\u662f\u786e\u5b9a\u5408\u5e76\u7684\u6761\u4ef6\u65f6\uff0c<code>if<\/code>\u8bed\u53e5\u53d8\u5f97\u5c24\u4e3a\u91cd\u8981\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-R\">if (some_condition) {<\/p>\n<p>  merged_data &lt;- merge(x, y, by = &quot;common_column&quot;)<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u7ed3\u6784\u610f\u5473\u7740\u4ec5\u5f53<code>some_condition<\/code>\u4e3a<code>TRUE<\/code>\u65f6\u624d\u6267\u884c\u6570\u636e\u5408\u5e76\u3002\u5728\u6267\u884c\u5408\u5e76\u524d\uff0c\u53ef\u4ee5\u68c0\u67e5\u6570\u636e\u7684\u7279\u5b9a\u5c5e\u6027\uff0c\u5982\u5217\u7684\u5b58\u5728\u6216\u5185\u5bb9\u5339\u914d\uff0c\u6765\u51b3\u5b9a\u662f\u5426\u8fdb\u884c\u5408\u5e76\u3002\u7ed3\u5408<code>if<\/code>\u8bed\u53e5\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0\u66f4\u4e3a\u590d\u6742\u7684\u6570\u636e\u5408\u5e76\u7b56\u7565\uff0c\u4f8b\u5982\u5206\u6bb5\u5408\u5e76\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u952e\u503c\u4e0d\u5b58\u5728\u65f6\u5e94\u7528\u9ed8\u8ba4\u503c\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528MERGE\u548cIF\u7ed3\u5408\u7684\u5b9e\u9645\u6848\u4f8b<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u4ee5\u4e00\u4e2a\u5177\u4f53\u7684\u6848\u4f8b\u6765\u5c55\u73b0\u5408\u5e76\u6570\u636e\u548c\u6761\u4ef6\u5224\u522b\u7684\u7ed3\u5408\u5e94\u7528\u3002\u5047\u8bbe\u6211\u4eec\u6709\u4e24\u4e2a\u6570\u636e\u6846\uff0c<code>df_sales<\/code>\u5305\u542b\u9500\u552e\u6570\u636e\uff0c<code>df_product<\/code>\u5305\u542b\u4ea7\u54c1\u4fe1\u606f\uff0c\u6211\u4eec\u5e0c\u671b\u5c06\u8fd9\u4e24\u8005\u6839\u636e\u4ea7\u54c1ID\u5408\u5e76\uff0c\u5e76\u4e14\u4ec5\u5408\u5e76<code>df_sales<\/code>\u4e2d\u6307\u5b9a\u5e74\u4efd\u7684\u6570\u636e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-R\">target_year &lt;- 2021<\/p>\n<p>if (target_year %in% df_sales$year) {<\/p>\n<p>  # \u4ec5\u5408\u5e76target_year\u5bf9\u5e94\u7684\u884c<\/p>\n<p>  df_sales_target &lt;- subset(df_sales, year == target_year)<\/p>\n<p>  merged_data &lt;- merge(df_sales_target, df_product, by = &quot;product_id&quot;, all.x = TRUE)<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7<code>if<\/code>\u8bed\u53e5\u6211\u4eec\u9996\u5148\u68c0\u67e5\u4e86<code>df_sales<\/code>\u6570\u636e\u6846\u4e2d\u662f\u5426\u5305\u542b\u76ee\u6807\u5e74\u4efd\u7684\u6570\u636e\uff0c\u7136\u540e\u4f7f\u7528<code>subset()<\/code>\u51fd\u6570\u6765\u83b7\u53d6\u8be5\u5e74\u4efd\u5bf9\u5e94\u7684\u5b50\u96c6\u6570\u636e\uff0c\u6700\u540e\u6267\u884c\u4e86\u5408\u5e76\u64cd\u4f5c\uff0c\u4fdd\u8bc1\u4e86\u53ea\u6709\u7279\u5b9a\u5e74\u4efd\u7684\u9500\u552e\u6570\u636e\u4e0e\u4ea7\u54c1\u4fe1\u606f\u76f8\u5173\u8054\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5904\u7406MERGE\u4e2d\u7684\u590d\u6742\u6761\u4ef6\u548c\u5f02\u5e38<\/h3>\n<\/p>\n<p><p>\u5728\u4e00\u4e9b\u590d\u6742\u7684\u5e94\u7528\u573a\u666f\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u5bf9\u5408\u5e76\u7684\u6570\u636e\u6846\u6267\u884c\u66f4\u7ec6\u7c92\u5ea6\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u80fd\u60f3\u8981\u5408\u5e76\u6570\u636e\u7684\u540c\u65f6\uff0c\u68c0\u67e5\u67d0\u4e9b\u5217\u7684\u503c\u662f\u5426\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u3002\u5982\u679c\u8fd9\u4e9b\u6761\u4ef6\u4e0d\u6ee1\u8db3\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u8c03\u6574\u6570\u636e\u5185\u5bb9\u6216\u91c7\u53d6\u5176\u4ed6\u7b56\u7565\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c<code>if<\/code>\u8bed\u53e5\u548c\u5faa\u73af\u7ed3\u6784<code>for<\/code>\u6216<code>apply<\/code>\u51fd\u6570\u53ef\u4ee5\u4e00\u8d77\u4f7f\u7528\u6765\u5b9e\u73b0\u590d\u6742\u5408\u5e76\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-R\">for (row in 1:nrow(df_sales)) {<\/p>\n<p>  if (df_sales$product_id[row] %in% df_product$product_id) {<\/p>\n<p>    # \u5408\u5e76\u6761\u4ef6\u6ee1\u8db3\u65f6\u7684\u64cd\u4f5c<\/p>\n<p>  } else {<\/p>\n<p>    # \u6761\u4ef6\u4e0d\u6ee1\u8db3\u65f6\u7684\u5176\u4ed6\u64cd\u4f5c<\/p>\n<p>  }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6b64\u7ed3\u6784\u4e2d\uff0c<code>for<\/code>\u5faa\u73af\u904d\u5386\u4e86<code>df_sales<\/code>\u7684\u6bcf\u4e00\u884c\uff0c<code>if<\/code>\u8bed\u53e5\u5219\u9488\u5bf9\u6bcf\u884c\u68c0\u67e5\u4e86\u4ea7\u54c1ID\u662f\u5426\u5b58\u5728\u4e8e<code>df_product<\/code>\u4e2d\u3002\u8fd9\u6837\u53ef\u4ee5\u5bf9\u6bcf\u4e2a\u5339\u914d\u7684\u60c5\u51b5\u505a\u4e2a\u4f53\u5316\u5904\u7406\uff0c\u5e76\u9002\u5e94\u90a3\u4e9b\u4e0d\u80fd\u7b80\u5355\u901a\u8fc7<code>merge()<\/code>\u51fd\u6570\u4e00\u6b21\u6027\u89e3\u51b3\u7684\u5408\u5e76\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f18\u5316MERGE\u548cIF\u64cd\u4f5c\u7684\u6027\u80fd<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\u5408\u5e76\u65f6\uff0c\u6027\u80fd\u6210\u4e3a\u4e00\u4e2a\u5173\u952e\u8003\u91cf\u56e0\u7d20\u3002\u7531\u4e8e<code>merge()<\/code>\u51fd\u6570\u5728\u5927\u6570\u636e\u96c6\u4e0a\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\uff0c\u56e0\u6b64\u4f18\u5316\u5408\u5e76\u64cd\u4f5c\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u9996\u5148\uff0c\u8003\u8651\u9884\u5148\u6392\u5e8f\u6570\u636e\u6846\u4e2d\u7684\u952e\u503c\u5217\u6765\u63d0\u9ad8\u5408\u5e76\u7684\u6548\u7387\u3002\u5176\u6b21\uff0c\u4f7f\u7528<code>data.table<\/code>\u5305\u4e2d\u7684<code>merge()<\/code>\u53ef\u4ee5\u5f97\u5230\u663e\u8457\u7684\u901f\u5ea6\u63d0\u5347\u3002\u6b64\u5916\uff0c\u9002\u5f53\u4f7f\u7528<code>if<\/code>\u6761\u4ef6\u5224\u522b\u6765\u51cf\u5c11\u5408\u5e76\u64cd\u4f5c\u7684\u8303\u56f4\u4e5f\u662f\u4e00\u4e2a\u6709\u6548\u7684\u7b56\u7565\u3002<\/p>\n<\/p>\n<p><p>\u6570\u636e\u5408\u5e76\u65f6\u7684\u6027\u80fd\u4f18\u5316\uff0c\u4e0d\u4ec5\u5728\u4e8e\u9009\u62e9\u9ad8\u6548\u7684\u51fd\u6570\u6216\u5305\uff0c\u4e5f\u5728\u4e8e\u5bf9\u6570\u636e\u5904\u7406\u6d41\u7a0b\u7684\u7cbe\u5fc3\u8bbe\u8ba1\u3002\u5728\u53ef\u80fd\u7684\u60c5\u51b5\u4e0b\uff0c\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u590d\u6742\u64cd\u4f5c\uff0c\u7b80\u5316\u5408\u5e76\u6761\u4ef6\u5e76\u80fd\u663e\u8457\u964d\u4f4e\u8ba1\u7b97\u65f6\u95f4\uff0c\u5c24\u5176\u662f\u5728\u64cd\u4f5c\u5927\u578b\u6570\u636e\u6846\u65f6\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528<code>merge()<\/code>\u51fd\u6570\u7ed3\u5408<code>if<\/code>\u5224\u522b\u8bed\u53e5\u5728R\u8bed\u8a00\u4e2d\u5b9e\u73b0\u590d\u6742\u7684\u6570\u636e\u5339\u914d\u64cd\u4f5c\u3002\u8fd9\u4e0d\u4f46\u589e\u52a0\u4e86\u6570\u636e\u5904\u7406\u7684\u7075\u6d3b\u6027\uff0c\u800c\u4e14\u53ef\u4ee5\u9488\u5bf9\u4e0d\u540c\u7684\u6570\u636e\u5173\u7cfb\u548c\u4e1a\u52a1\u903b\u8f91\u8fdb\u884c\u7ec6\u7c92\u5ea6\u7684\u63a7\u5236\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728R\u8bed\u8a00\u4e2d\u4f7f\u7528merge\u51fd\u6570\u8fdb\u884c\u6570\u636e\u5339\u914d\uff1f<\/strong><\/p>\n<p>\u5728R\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528merge\u51fd\u6570\u6765\u8fdb\u884c\u6570\u636e\u7684\u5339\u914d\u3002\u901a\u8fc7merge\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u4e24\u4e2a\u6216\u591a\u4e2a\u6570\u636e\u6846\u6309\u7167\u6307\u5b9a\u7684\u5217\u8fdb\u884c\u5408\u5e76\u3002\u5408\u5e76\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u5185\u8fde\u63a5\u3001\u5de6\u8fde\u63a5\u3001\u53f3\u8fde\u63a5\u6216\u5916\u8fde\u63a5\u7b49\u4e0d\u540c\u7684\u65b9\u5f0f\u3002<\/p>\n<p><strong>2. R\u8bed\u8a00\u4e2d\u7684if\u8bed\u53e5\u5982\u4f55\u5224\u65ad\u5339\u914d\u6761\u4ef6\uff1f<\/strong><\/p>\n<p>\u5728R\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528if\u8bed\u53e5\u6765\u5224\u65ad\u5339\u914d\u6761\u4ef6\u3002if\u8bed\u53e5\u7684\u57fa\u672c\u7ed3\u6784\u662fif(\u6761\u4ef6){\u6267\u884c\u8bed\u53e5}\uff0c\u5176\u4e2d\u6761\u4ef6\u53ef\u4ee5\u662f\u6bd4\u8f83\u8fd0\u7b97\u7b26\uff08\u5982&lt;\u3001&gt;\u3001==\uff09\u6216\u903b\u8f91\u8fd0\u7b97\u7b26\uff08\u5982&amp;&amp;\u3001||\uff09\u7684\u7ec4\u5408\u3002\u901a\u8fc7\u5224\u65ad\u6761\u4ef6\u7684\u771f\u5047\uff0c\u53ef\u4ee5\u6267\u884c\u76f8\u5e94\u7684\u5339\u914d\u64cd\u4f5c\u3002<\/p>\n<p><strong>3. \u5982\u4f55\u5728R\u8bed\u8a00\u4e2d\u4f7f\u7528if\u6765\u8fdb\u884c\u5339\u914d\u5224\u522b\uff1f<\/strong><\/p>\n<p>\u5728R\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528if\u8bed\u53e5\u6765\u8fdb\u884c\u5339\u914d\u5224\u522b\u3002\u4f8b\u5982\uff0c\u901a\u8fc7if\u8bed\u53e5\u53ef\u4ee5\u5224\u65ad\u67d0\u4e2a\u53d8\u91cf\u7684\u53d6\u503c\u662f\u5426\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\uff0c\u7136\u540e\u6267\u884c\u76f8\u5e94\u7684\u64cd\u4f5c\u3002\u5982\u679c\u6761\u4ef6\u6210\u7acb\uff0c\u5219\u6267\u884cif\u8bed\u53e5\u5757\u4e2d\u7684\u4ee3\u7801\uff1b\u5982\u679c\u6761\u4ef6\u4e0d\u6210\u7acb\uff0c\u5219\u8df3\u8fc7if\u8bed\u53e5\u5757\uff0c\u7ee7\u7eed\u6267\u884c\u540e\u9762\u7684\u4ee3\u7801\u3002\u901a\u8fc7if\u8bed\u53e5\u7684\u5d4c\u5957\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u5339\u914d\u5224\u522b\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5173\u4e8eR\u8bed\u8a00\u4e2d\u7684\u5339\u914d\uff0c\u4f7f\u7528merge()\u51fd\u6570\u7ed3\u5408if\u8bed\u53e5\u7684\u5224\u522b\u53ef\u4ee5\u6709\u6548\u5730\u8fdb\u884c\u6570\u636e\u6846\u7684\u5408\u5e76\u3001\u5173\u952e\u5217\u7684\u5339\u914d\u548c\u6761\u4ef6\u7b5b\u9009 [&hellip;]","protected":false},"author":3,"featured_media":180496,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/180486"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=180486"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/180486\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/180496"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=180486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=180486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=180486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}