{"id":47397,"date":"2024-12-02T14:47:03","date_gmt":"2024-12-02T06:47:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/47397\/"},"modified":"2024-12-02T14:47:03","modified_gmt":"2024-12-02T06:47:03","slug":"php-%e5%87%bd%e6%95%b0%e4%b8%ad%e5%bc%95%e7%94%a8%e4%bc%a0%e9%80%92%e7%9a%84%e5%86%85%e5%ad%98%e6%95%88%e7%8e%87%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/47397\/","title":{"rendered":"PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316<\/h1>\n<p>\u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6587\u7ae0\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300aPHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/p>\n<p>\u5728 PHP \u4e2d\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u53ef\u4ee5\u63d0\u9ad8\u6548\u7387\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u95ee\u9898\uff1a\u5185\u5b58\u6cc4\u6f0f\uff1a \u610f\u5916\u521b\u5efa\u989d\u5916\u7684\u5f15\u7528\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002\u6570\u636e\u9519\u8bef\uff1a \u591a\u4e2a\u5f15\u7528\u6307\u5411\u540c\u4e00\u53d8\u91cf\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u56e0\u4e3a\u51fd\u6570\u4e2d\u7684\u66f4\u6539\u4f1a\u5f71\u54cd\u539f\u59cb\u53d8\u91cf\u53ca\u5176\u526f\u672c\u3002\u4f18\u5316\u5efa\u8bae\uff1a\u4ec5\u5728\u5fc5\u8981\u65f6\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u3002\u660e\u786e\u7ba1\u7406\u5f15\u7528\uff0c\u4f7f\u7528 unset() \u9500\u6bc1\u4e0d\u518d\u9700\u8981\u7684\u5f15\u7528\u3002\u4f7f\u7528\u533f\u540d\u51fd\u6570\uff08\u95ed\u5305\uff09\u521b\u5efa\u5bf9\u5916\u90e8\u53d8\u91cf\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u5fc5\u5b9e\u9645\u4f20\u9012\u5f15\u7528\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241026\/1729915651671c6b03efef3.jpg\" class=\"aligncenter\" title=\"PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316\u63d2\u56fe\" alt=\"PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316\u63d2\u56fe\" \/><\/p>\n<p><strong>PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316<\/strong><\/p>\n<p><strong>\u7b80\u4ecb<\/strong><\/p>\n<p>\u5728 PHP \u4e2d\uff0c\u51fd\u6570\u53c2\u6570\u53ef\u4ee5\u901a\u8fc7\u5f15\u7528\u4f20\u9012\uff0c\u8fd9\u53ef\u4ee5\u63d0\u9ad8\u590d\u6742\u6570\u636e\u7ed3\u6784\u7684\u5904\u7406\u6548\u7387\u3002\u7136\u800c\uff0c\u4e0d\u5f53\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5185\u5b58\u6548\u7387\u4f4e\u4e0b\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u95ee\u9898\uff0c\u5e76\u63d0\u4f9b\u4f18\u5316\u5efa\u8bae\u3002<\/p>\n<p><strong>\u5f15\u7528\u4f20\u9012\u7684\u6548\u7387\u95ee\u9898<\/strong><\/p>\n<p>\u5f53\u4e00\u4e2a\u53d8\u91cf\u901a\u8fc7\u5f15\u7528\u4f20\u9012\u7ed9\u51fd\u6570\u65f6\uff0cPHP \u4e0d\u4f1a\u4e3a\u8be5\u53d8\u91cf\u521b\u5efa\u526f\u672c\u3002\u76f8\u53cd\uff0c\u51fd\u6570\u4f1a\u76f4\u63a5\u64cd\u4f5c\u539f\u59cb\u53d8\u91cf\u7684\u5185\u5b58\u5730\u5740\u3002\u867d\u7136\u8fd9\u5bf9\u5927\u578b\u6570\u636e\u7ed3\u6784\u5f88\u6709\u7528\uff0c\u4f46\u4e5f\u4f1a\u5bfc\u81f4\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n<ul>\n<li><strong>\u5185\u5b58\u6cc4\u6f0f\uff1a<\/strong>\u5982\u679c\u51fd\u6570\u610f\u5916\u521b\u5efa\u6307\u5411\u539f\u59cb\u53d8\u91cf\u7684\u989d\u5916\u5f15\u7528\uff0c\u5219\u539f\u59cb\u53d8\u91cf\u53ca\u5176\u5f15\u7528\u6240\u6307\u5411\u7684\u6570\u636e\u90fd\u5c06\u4fdd\u7559\u5728\u5185\u5b58\u4e2d\uff0c\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002<\/li>\n<li><strong>\u6570\u636e\u9519\u8bef\uff1a<\/strong>\u591a\u4e2a\u5f15\u7528\u6307\u5411\u540c\u4e00\u53d8\u91cf\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u56e0\u4e3a\u51fd\u6570\u4e2d\u7684\u66f4\u6539\u4f1a\u5f71\u54cd\u539f\u59cb\u53d8\u91cf\u53ca\u5176\u526f\u672c\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u5316\u5efa\u8bae<\/strong><\/p>\n<p>\u4e3a\u4e86\u63d0\u9ad8\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\uff0c\u8bf7\u8003\u8651\u4ee5\u4e0b\u5efa\u8bae\uff1a<\/p>\n<ul>\n<li><strong>\u4ec5\u5728\u7edd\u5bf9\u5fc5\u8981\u65f6\u4f7f\u7528\u5f15\u7528\u4f20\u9012\uff1a<\/strong>\u4e0d\u8981\u4ec5\u4ec5\u4e3a\u4e86\u63d0\u9ad8\u6548\u7387\u800c\u6ee5\u7528\u5f15\u7528\u4f20\u9012\u3002\u4ec5\u5728\u51fd\u6570\u9700\u8981\u76f4\u63a5\u4fee\u6539\u53d8\u91cf\u7684\u503c\u65f6\u4f7f\u7528\u5b83\u3002<\/li>\n<li><strong>\u660e\u786e\u7ba1\u7406\u5f15\u7528\uff1a<\/strong>\u4e00\u65e6\u4e0d\u518d\u9700\u8981\u5bf9\u539f\u59cb\u53d8\u91cf\u7684\u5f15\u7528\uff0c\u8bf7\u4f7f\u7528 <code>unset()<\/code> \u51fd\u6570\u663e\u5f0f\u9500\u6bc1\u5b83\u3002\u8fd9\u5c06\u91ca\u653e\u8be5\u5f15\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u3002<\/li>\n<li><strong>\u4f7f\u7528\u533f\u540d\u51fd\u6570\uff08\u95ed\u5305\uff09\uff1a<\/strong>\u95ed\u5305\u53ef\u4ee5\u521b\u5efa\u5bf9\u5916\u90e8\u53d8\u91cf\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u5fc5\u5b9e\u9645\u4f20\u9012\u5f15\u7528\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u4ee3\u7801\u4f7f\u7528\u95ed\u5305\u5728\u51fd\u6570\u5185\u8bbf\u95ee $x\uff1a<\/li>\n<\/ul>\n<pre>function foo() {\n  $x = 1;\n  $bar = function() use (&amp;$x) {\n    return $x++;\n  };\n  return $bar;\n}<\/pre>\n<p><strong>\u5b9e\u6218\u6848\u4f8b<\/strong><\/p>\n<p>\u8003\u8651\u4ee5\u4e0b\u51fd\u6570\uff0c\u7528\u4e8e\u5bf9\u6570\u7ec4\u4e2d\u7684\u6570\u5b57\u6c42\u548c\uff1a<\/p>\n<pre>function sumArray(array $array) {\n  $sum = 0;\n  foreach ($array as $number) {\n    $sum += $number;\n  }\n  return $sum;\n}<\/pre>\n<p>\u5728\u8fd9\u4e2a\u51fd\u6570\u4e2d\uff0c$array \u53c2\u6570\u901a\u8fc7\u503c\u4f20\u9012\u3002\u8fd9\u610f\u5473\u7740 PHP \u4e3a $array \u7684\u4e00\u4e2a\u526f\u672c\u521b\u5efa\u4e86\u5185\u5b58\u7a7a\u95f4\uff0c\u7136\u540e\u5728\u51fd\u6570\u5185\u5bf9\u526f\u672c\u8fdb\u884c\u64cd\u4f5c\u3002\u5bf9\u4e8e\u5c0f\u6570\u7ec4\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u79cd\u6548\u7387\u5f88\u9ad8\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5982\u679c $array \u975e\u5e38\u5927\uff0c\u5219\u521b\u5efa\u526f\u672c\u53ef\u80fd\u4f1a\u6d6a\u8d39\u5927\u91cf\u5185\u5b58\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5f15\u7528\u4f20\u9012\uff1a<\/p>\n<pre>function sumArrayRef(array &amp;$array) {\n  $sum = 0;\n  foreach ($array as $number) {\n    $sum += $number;\n  }\n  return $sum;\n}<\/pre>\n<p>\u901a\u8fc7\u5f15\u7528\u4f20\u9012 $array \uff0cPHP \u53ef\u4ee5\u5728\u51fd\u6570\u5185\u76f4\u63a5\u64cd\u4f5c\u539f\u59cb\u6570\u7ec4\uff0c\u800c\u65e0\u9700\u521b\u5efa\u526f\u672c\u3002\u8fd9\u53ef\u4ee5\u8282\u7701\u5927\u91cf\u7684\u5185\u5b58\uff0c\u7279\u522b\u662f\u5bf9\u4e8e\u5927\u578b\u6570\u7ec4\u3002<\/p>\n<p><strong>\u7ed3\u8bba<\/strong><\/p>\n<p>\u5f15\u7528\u4f20\u9012\u662f\u4e00\u79cd\u6709\u4ef7\u503c\u7684\u6280\u672f\uff0c\u53ef\u4ee5\u5728 PHP \u4e2d\u63d0\u9ad8\u5185\u5b58\u6548\u7387\u3002\u4f46\u662f\uff0c\u4e3a\u4e86\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u548c\u6570\u636e\u9519\u8bef\uff0c\u8bf7\u8c28\u614e\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u5e76\u9075\u5faa\u672c\u6587\u4e2d\u6982\u8ff0\u7684\u4f18\u5316\u5efa\u8bae\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316 \u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6587\u7ae0\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300aPHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~ \u5728 PHP \u4e2d\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u53ef\u4ee5\u63d0\u9ad8\u6548\u7387\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u95ee\u9898\uff1a\u5185\u5b58\u6cc4\u6f0f\uff1a \u610f\u5916\u521b\u5efa\u989d\u5916\u7684\u5f15\u7528\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002\u6570\u636e\u9519\u8bef\uff1a \u591a\u4e2a\u5f15\u7528\u6307\u5411\u540c\u4e00\u53d8\u91cf\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u56e0\u4e3a\u51fd\u6570\u4e2d\u7684\u66f4\u6539\u4f1a\u5f71\u54cd\u539f\u59cb\u53d8\u91cf\u53ca\u5176\u526f\u672c\u3002\u4f18\u5316\u5efa\u8bae\uff1a\u4ec5\u5728\u5fc5\u8981\u65f6\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u3002\u660e\u786e\u7ba1\u7406\u5f15\u7528\uff0c\u4f7f\u7528 unset() \u9500\u6bc1\u4e0d\u518d\u9700\u8981\u7684\u5f15\u7528\u3002\u4f7f\u7528\u533f\u540d\u51fd\u6570\uff08\u95ed\u5305\uff09\u521b\u5efa\u5bf9\u5916\u90e8\u53d8\u91cf\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u5fc5\u5b9e\u9645\u4f20\u9012\u5f15\u7528\u3002 PHP \u51fd\u6570\u4e2d\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u4f18\u5316 \u7b80\u4ecb \u5728 PHP \u4e2d\uff0c\u51fd\u6570\u53c2\u6570\u53ef\u4ee5\u901a\u8fc7\u5f15\u7528\u4f20\u9012\uff0c\u8fd9\u53ef\u4ee5\u63d0\u9ad8\u590d\u6742\u6570\u636e\u7ed3\u6784\u7684\u5904\u7406\u6548\u7387\u3002\u7136\u800c\uff0c\u4e0d\u5f53\u4f7f\u7528\u5f15\u7528\u4f20\u9012\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5185\u5b58\u6548\u7387\u4f4e\u4e0b\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\u95ee\u9898\uff0c\u5e76\u63d0\u4f9b\u4f18\u5316\u5efa\u8bae\u3002 \u5f15\u7528\u4f20\u9012\u7684\u6548\u7387\u95ee\u9898 \u5f53\u4e00\u4e2a\u53d8\u91cf\u901a\u8fc7\u5f15\u7528\u4f20\u9012\u7ed9\u51fd\u6570\u65f6\uff0cPHP \u4e0d\u4f1a\u4e3a\u8be5\u53d8\u91cf\u521b\u5efa\u526f\u672c\u3002\u76f8\u53cd\uff0c\u51fd\u6570\u4f1a\u76f4\u63a5\u64cd\u4f5c\u539f\u59cb\u53d8\u91cf\u7684\u5185\u5b58\u5730\u5740\u3002\u867d\u7136\u8fd9\u5bf9\u5927\u578b\u6570\u636e\u7ed3\u6784\u5f88\u6709\u7528\uff0c\u4f46\u4e5f\u4f1a\u5bfc\u81f4\u4ee5\u4e0b\u95ee\u9898\uff1a \u5185\u5b58\u6cc4\u6f0f\uff1a\u5982\u679c\u51fd\u6570\u610f\u5916\u521b\u5efa\u6307\u5411\u539f\u59cb\u53d8\u91cf\u7684\u989d\u5916\u5f15\u7528\uff0c\u5219\u539f\u59cb\u53d8\u91cf\u53ca\u5176\u5f15\u7528\u6240\u6307\u5411\u7684\u6570\u636e\u90fd\u5c06\u4fdd\u7559\u5728\u5185\u5b58\u4e2d\uff0c\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002 \u6570\u636e\u9519\u8bef\uff1a\u591a\u4e2a\u5f15\u7528\u6307\u5411\u540c\u4e00\u53d8\u91cf\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u56e0\u4e3a\u51fd\u6570\u4e2d\u7684\u66f4\u6539\u4f1a\u5f71\u54cd\u539f\u59cb\u53d8\u91cf\u53ca\u5176\u526f\u672c\u3002 \u4f18\u5316\u5efa\u8bae \u4e3a\u4e86\u63d0\u9ad8\u5f15\u7528\u4f20\u9012\u7684\u5185\u5b58\u6548\u7387\uff0c\u8bf7\u8003\u8651\u4ee5\u4e0b\u5efa\u8bae\uff1a \u4ec5\u5728\u7edd\u5bf9\u5fc5\u8981\u65f6\u4f7f\u7528\u5f15\u7528\u4f20\u9012\uff1a\u4e0d\u8981\u4ec5\u4ec5\u4e3a\u4e86\u63d0\u9ad8\u6548\u7387\u800c\u6ee5\u7528\u5f15\u7528\u4f20\u9012\u3002\u4ec5\u5728\u51fd\u6570\u9700\u8981\u76f4\u63a5\u4fee\u6539\u53d8\u91cf\u7684\u503c\u65f6\u4f7f\u7528\u5b83\u3002 \u660e\u786e\u7ba1\u7406\u5f15\u7528\uff1a\u4e00\u65e6\u4e0d\u518d\u9700\u8981\u5bf9\u539f\u59cb\u53d8\u91cf\u7684\u5f15\u7528\uff0c\u8bf7\u4f7f\u7528 unset() \u51fd\u6570\u663e\u5f0f\u9500\u6bc1\u5b83\u3002\u8fd9\u5c06\u91ca\u653e\u8be5\u5f15\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u3002 \u4f7f\u7528\u533f\u540d\u51fd\u6570\uff08\u95ed\u5305\uff09\uff1a\u95ed\u5305\u53ef\u4ee5\u521b\u5efa\u5bf9\u5916\u90e8\u53d8\u91cf\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u5fc5\u5b9e\u9645\u4f20\u9012\u5f15\u7528\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u4ee3\u7801\u4f7f\u7528\u95ed\u5305\u5728\u51fd\u6570\u5185\u8bbf\u95ee $x\uff1a function foo() { $x = 1; $bar = function() use (&amp;$x) { return $x++; }; return $bar; } \u5b9e\u6218\u6848\u4f8b \u8003\u8651\u4ee5\u4e0b\u51fd\u6570\uff0c\u7528\u4e8e\u5bf9\u6570\u7ec4\u4e2d\u7684\u6570\u5b57\u6c42\u548c\uff1a function sumArray(array $array) { $sum [&hellip;]<\/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-47397","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47397","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=47397"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47397\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=47397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=47397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=47397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}