{"id":10393,"date":"2022-04-30T23:41:33","date_gmt":"2022-04-30T15:41:33","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=10393"},"modified":"2022-04-30T23:44:11","modified_gmt":"2022-04-30T15:44:11","slug":"js-new-function","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2022\/04\/js-new-function\/","title":{"rendered":"\u6df1\u5165 JS new Function \u8bed\u6cd5"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=10393\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=10393<\/a> \u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202204-new-function.png';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/js-new-function-cover.png\" width=\"480\" height=\"297\" alt=\"\u5361\u901a\u52a8\u7269\u5c01\u9762\u56fe\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u8bed\u6cd5<\/h3>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>let func = new Function ([arg1, arg2, ...argN], functionBody);<\/pre>\n<p>\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4e00\u5b9a\u662f\u51fd\u6570\u4f53\uff0c\u5176\u4f59\u53c2\u6570\u90fd\u4f5c\u4e3a\u4f20\u7ed9\u51fd\u6570\u4f53\u7684\u53c2\u6570\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>let sum = new Function('a', 'b', 'return a + b');\r\n\r\nconsole.log(sum(1, 2)); \/\/ \u7ed3\u679c\u662f 3<\/pre>\n<p>\u5e73\u5e38\u8fdb\u884c JS \u6216\u8005 Node.js \u5f00\u53d1\u7684\u65f6\u5019\uff0c\u6211\u4eec\u662f\u6ca1\u6709\u4efb\u4f55\u7406\u7531\u4f7f\u7528 new Function \u6784\u9020\u51fd\u6570\u7684\uff0c\u56e0\u4e3a\u6ca1\u5fc5\u8981\uff0c\u76f4\u63a5\u4f7f\u7528 <code>function<\/code> \u6216\u8005 <code>() =&gt; {}<\/code> \u7bad\u5934\u51fd\u6570\u5199\u6cd5\u5c31\u597d\u4e86\u3002<\/p>\n<p>\u90a3\u662f\u4e0d\u662f\u8868\u793a new Function \u8bed\u6cd5\u662f\u4e2a\u9e21\u808b\u7279\u6027\u5462\uff1f<\/p>\n<p>\u4e0d\uff01\u7edd\u4e0d\u662f\uff01<\/p>\n<p>new Function \u8bed\u6cd5\u6709\u4e2a\u7279\u522b\u5389\u5bb3\u7684\u7279\u6027\uff0c\u4f7f\u5176\u6210\u4e3a JavaScript \u8fd9\u95e8\u8bed\u8a00\u4e2d\u65e0\u53ef\u66ff\u4ee3\u7684\u91cd\u8981\u89d2\u8272\u3002\u3002<\/p>\n<p>\u4ec0\u4e48\u7279\u6027\u5462\uff1f<\/p>\n<p>\u90a3\u5c31\u662f\u51fd\u6570\u4f53\u7684\u6570\u636e\u683c\u5f0f\u662f\u5b57\u7b26\u4e32\uff0c\u8fd9\u53ef\u662f\u4e2a\u4e0d\u5f97\u4e86\u7684\u4e1c\u897f\u554a\uff01<\/p>\n<h3>\u4e8c\u3001\u65e0\u53ef\u66ff\u4ee3\u7684\u4f5c\u7528<\/h3>\n<p>\u4e3e\u51e0\u4e2a\u4f8b\u5b50\uff0c\u5c55\u793a\u4e0b new Function \u7684\u7cbe\u5999\u4f5c\u7528\u3002<\/p>\n<h4>1. \u975e\u5408\u6cd5 JSON \u5bf9\u8c61\u5b57\u7b26\u4e32\u5408\u6cd5\u5316<\/h4>\n<p>\u4f8b\u5982\uff0c\u6709\u4e0b\u9762\u4e00\u6bb5\u5b57\u7b26\u4e32\uff1a<\/p>\n<pre>let str = `{ \"id\": 10393, name: 'zhangxinxu', 'date': '2022-04-30' }`;<\/pre>\n<p>\u5176\u4e2d\u7684\u5b57\u7b26\u4e32\u4e0d\u7b26\u5408 JSON \u683c\u5f0f\uff08\u952e\u503c\u9700\u8981\u53cc\u5f15\u53f7\uff09\uff0c\u6b64\u65f6\u5982\u679c\u4f7f\u7528 <code>JSON.parse()<\/code> \u8fdb\u884c\u89e3\u6790\u662f\u4f1a\u62a5\u9519\u7684\u3002<\/p>\n<p>\u622a\u56fe\u793a\u610f\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/2022-04-30_215052.png\" width=\"499\" height=\"166\" alt=\"JSON \u62a5\u9519\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u90a3\u6709\u4ec0\u4e48\u529e\u6cd5\u5c06\u8fd9\u6bb5\u5b57\u7b26\u4e32\u5bf9\u8c61\u8f6c\u6362\u6210 JSON \u53ef\u4ee5\u89e3\u6790\u7684\u5462\uff1f<\/p>\n<p>\u5f88\u591a\u4eba\u4f1a\u60f3\u5230\u8fdb\u884c\u6b63\u5219\u5339\u914d\u518d\u66ff\u6362\uff0c\u6216\u8005\u4f7f\u7528 <code>eval<\/code> \u8fd9\u6837\u7cdf\u7c95\u7684\u5c5e\u6027\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<p>\u65e0\u9700\u8fd9\u4e48\u9ebb\u70e6\uff0cnew Function \u51fa\u9a6c\uff0c\u9a6c\u5230\u6210\u529f\uff01<\/p>\n<p>JS \u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>console.log(JSON.stringify(new Function('return ' + str)()));\r\n\/\/ \u8fd4\u56de\u7ed3\u679c\u662f\uff1a'{\"id\":10393,\"name\":\"zhangxinxu\",\"date\":\"2022-04-30\"}'<\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\u622a\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/2022-04-30_220023.png\" width=\"534\" height=\"165\" alt=\"JSON \u5b57\u7b26\u4e32\u5408\u6cd5\u5316\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u914d\u5408 <code>return<\/code> \u8bed\u6cd5\uff0c\u53ef\u4ee5\u8f7b\u8f7b\u677e\u677e\u5c06\u4efb\u610f\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u6210\u5176\u4ed6 JS \u6570\u636e\u7c7b\u578b\u3002<\/p>\n<h4>2. \u6a21\u677f\u5b57\u7b26\u4e32\u4f5c\u4e3a\u6a21\u677f<\/h4>\n<p>\u8fd9\u4e2a\u5e94\u7528\u5728\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/10\/es6-html-template-literal\/\">ES6\u6a21\u677f\u5b57\u7b26\u4e32\u5728HTML\u6a21\u677f\u6e32\u67d3\u4e2d\u7684\u5e94\u7528<\/a>\u201d\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u6709\u8be6\u7ec6\u7684\u4ecb\u7ecd\uff0c\u6211\u8fd9\u91cc\u518d\u7b80\u5355\u4ecb\u7ecd\u4e0b\u3002<\/p>\n<p>\u4f8b\u5982\u73b0\u5728\u7684Vue\uff0cReact\u7b49\uff0c\u90fd\u6709\u81ea\u5df1\u7684\u6a21\u677f\u8bed\u6cd5\uff0c\u4f8b\u5982 <code>{}<\/code> \u8fd9\u6837\u5b50\u7684\u8bed\u6cd5\u7b49\u3002<\/p>\n<p>\u5982\u679c\u6211\u4eec\u5e0c\u671b\u76f4\u63a5\u4f7f\u7528 ES6 \u81ea\u5e26\u7684\u8bed\u6cd5\u4f5c\u4e3a\u6a21\u677f\u8bed\u8a00\uff0c\u5219\u5fc5\u987b\u8981\u501f\u52a9 new Function \u7684\u80fd\u529b\u4e86\uff0c\u4f8b\u5982\u6709\u5982\u4e0b HTML\uff1a<\/p>\n<pre>&lt;template id=\"template\"&gt;\r\n  ${data.map(function (obj, index) {\r\n    return `&lt;p&gt;\u6587\u7ae0\uff1a${obj.article}&lt;\/p&gt;\r\n&lt;p&gt;\u4f5c\u8005\uff1a${obj.author}&lt;\/p&gt;\r\n`;\r\n  }).join('')}\r\n&lt;\/template&gt;<\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u6269\u5c55\u5b57\u7b26\u4e32\uff0c\u5b9a\u4e49\u4e2a\u540d\u4e3a interpolate \u7684\u5b57\u7b26\u4e32\u65b9\u6cd5\uff0c\u8ba9 ES6 \u7684\u8bed\u6cd5\u5b57\u7b26\u4e32\u53d8\u6210\u53ef\u6267\u884c\u7684 ES6 \u4ee3\u7801\uff1a<\/p>\n<pre>String.prototype.interpolate = function (params) {\r\n    const names = Object.keys(params);\r\n    const vals = Object.values(params);\r\n\r\n    return new Function(...names, `return \\`${this}\\`;`)(...vals);\r\n};<\/pre>\n<p>\u6b64\u65f6\uff0c\u53ea\u9700\u8981\u6709\u5bf9\u5e94\u7684\u6570\u636e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u57fa\u4e8e <code>&lt;template&gt;<\/code> \u6a21\u677f\u83b7\u5f97\u6700\u7ec8\u7f16\u8bd1\u7684 HTML \u5b57\u7b26\u4e32\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>const html = template.innerHTML.interpolate({\r\n  data: [{\r\n    article: '\u6587\u7ae0\u6807\u98981',\r\n    author: '\u5f20\u946b\u65ed'\r\n  }, {\r\n    article: '\u6587\u7ae0\u6807\u98982',\r\n    author: 'CSS\u65b0\u4e16\u754c'\r\n  }]\r\n});\r\n\r\nconsole.log(html);<\/pre>\n<p>\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u622a\u56fe\u6240\u793a\u7684\u7ed3\u679c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/2022-04-30_223718.png\" width=\"260\" height=\"168\" alt=\"\u6a21\u677f\u5904\u7406\u7ed3\u679c\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u65e0\u9700\u4efb\u4f55\u7b2c\u4e09\u65b9\u7684\u6a21\u677f\u6e32\u67d3\u5f15\u64ce\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u590d\u6742\u8bed\u6cd5\u4e0b\u7684\u6a21\u677f\u6e32\u67d3\u6548\u679c\uff0c\u539f\u751f JS \u7231\u597d\u8005\u72c2\u559c\u3002<\/p>\n<h3>\u4e09\u3001\u95ed\u5305\u4e0e\u4e0a\u4e0b\u6587<\/h3>\n<p>new Function \u4e3b\u4f53\u53c2\u6570\u4e2d\u7684\u53d8\u91cf\u7684\u4e0a\u4e0b\u6587\u662f\u5168\u5c40\u7684\uff0c\u800c\u4e0d\u662f\u79c1\u6709\u7684\uff0c\u6ca1\u6709\u6240\u8c13\u7684\u95ed\u5305\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e0b\u9762 new Function \u4ee3\u7801\u4e2d\u7684 value \u548c\u4e3b\u4f53\u51fd\u6570\u4e2d\u7684 value \u662f\u6ca1\u6709\u5173\u8054\u7684\uff1a<\/p>\n<pre>function getFunc() {\r\n  let value = 'zhangxinxu';\r\n\r\n  let func = new Function('console.log(value)');\r\n\r\n  return func;\r\n}\r\n\r\ngetFunc()(); \/\/ \u62a5\u9519\uff1a value \u672a\u5b9a\u4e49<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/2022-04-30_230645.png\" width=\"430\" height=\"236\" alt=\"value \u672a\u5b9a\u4e49\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u5982\u679c\u662f\u5e38\u89c4\u7684 function \u51fd\u6570\u8bed\u6cd5\uff0c\u5219\u4e0d\u4f1a\u6709\u95ee\u9898\uff1a<\/p>\n<pre>function getFunc() {\r\n  let value = 'zhangxinxu';\r\n  let func = function () {\r\n    console.log(value)\r\n  };\r\n\r\n  return func;\r\n}\r\n\r\ngetFunc()(); \/\/ \u6253\u5370 'zhangxinxu'<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/2022-04-30_230937.png\" width=\"240\" height=\"200\" alt=\"\u5e38\u89c4\u7528\u6cd5\u7684\u95ed\u5305\" class=\"alignnone size-medium\" \/><\/p>\n<h4>\u5176\u4ed6<\/h4>\n<p>\u548c new Funciton \u8bed\u6cd5\u7c7b\u4f3c\u7684\u8fd8\u6709 new RegExp\uff0c\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u4f5c\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u5185\u5bb9\uff0c\u7279\u522b\u4f7f\u7528\u5728\u52a8\u6001\u5339\u914d\uff0c\u6216\u8005\u589e\u52a0\u4ee3\u7801\u6df7\u6dc6\uff08\u6709\u4e9b\u6df7\u6dc6\u5de5\u5177\u53ef\u4ee5\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6df7\u6dc6\uff09\u7684\u573a\u5408\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5339\u914d\u52a8\u6001\u7684 value \u5f00\u5934\u7684\u5c5e\u6027\u503c\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u7528\u6cd5\uff1a<\/p>\n<pre>let reg = new RegExp('^' + value, 'g');<\/pre>\n<h3>\u56db\u3001\u4e94\u4e00\u8282\u5feb\u4e50<\/h3>\n<p>\u4eca\u5e74\u4e94\u4e00\u8282\u8fde\u4f11\u4e94\u5929\uff0c\u4eca\u5929\u7b2c\u4e00\u5929\uff0c\u8d76\u5728\u56db\u6708\u7684\u5c3e\u5df4\u5199\u5b8c\u8fd9\u7bc7\u6587\u7ae0\uff08\u73b0\u572823:11\uff09\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u56db\u5929\u4e89\u53d6\u5c0f\u8bf4\u91cd\u5199\u7ed3\u675f\uff0c\u7136\u540e\u5f00\u59cb\u300aCSS\u9009\u62e9\u5668\u4e16\u754c\u300b\u7b2c\u4e8c\u7248\u7684\u64b0\u5199\uff0c\u56e0\u4e3a\u75ab\u60c5\uff0c\u5408\u540c\u8fd8\u6ca1\u5bc4\u8fc7\u6765\u3002<\/p>\n<p>\u8bf4\u5230\u75ab\u60c5\uff0c\u8fd8\u6709\u5176\u4ed6\u7cdf\u5fc3\u7684\u4e8b\u60c5\u3002<\/p>\n<blockquote><p>\u4e0a\u5348\u51fa\u95e8\u505a\u6838\u9178\u51fa\u7684\u6025\uff0c\u5fd8\u8bb0\u5e26\u94a5\u5319\uff0c\u53ea\u80fd\u627e\u4eba\u5f00\u9501\u3002<\/p>\n<p>\u7ed3\u679c\u75ab\u60c5\u671f\u95f4\uff0c\u4e3a\u9632\u6b62\u4f20\u64ad\uff0c\u5f00\u9501\u7684\u4eba\u9700\u8981\u5728\u516c\u5b89\u5907\u6848\u624d\u884c\uff0c\u4f46\u662f\u7b26\u5408\u6761\u4ef6\u7684\u4eba\u5f88\u5c11\uff0c\u4e8e\u662f\uff0c\u5c31\u6ecb\u751f\u4e86\u4e2a\u4f53\u5784\u65ad\u3002<\/p>\n<p>\u4e8e\u662f\u5f00\u9501\u4ef7\u683c\u90a3\u662f\u60ca\u4e3a\u5929\u4eba\uff0c\u5148\u662f\u9501\u64ac\u4e0d\u5f00\uff08\u4e0d\u77e5\u9053\u771f\u64ac\u4e0d\u5f00\u8fd8\u662f\u5047\u7684\uff09\uff0c\u7136\u540e\u6362\u4e86\u4e2a\u9501\uff0c\u62a5\u4ef71400\uff0c\u8fd8\u52301200\u3002<\/p>\n<p>\u5173\u952e\u662f\u6362\u7684\u9501\u70c2\u7684\u4e0d\u5f97\u4e86\uff0c\u5916\u9762\u7684\u91d1\u5c5e\u6709\u5f00\u9501\u4eba\u7684\u624b\u673a\u53f7\uff08\u6253\u5728\u91d1\u5c5e\u4e0a\u7684\uff09\uff0c\u9501\u82af\u989c\u8272\u5b8c\u5168\u4e0d\u5bf9\uff0c\u677e\u52a8\uff0c\u8fd8\u53ef\u4ee5\u62d4\u51fa\u51e0\u5398\u7c73\uff0c\u4e14\u5185\u90e8\u65e0\u6cd5\u94a5\u5319\u53cd\u9501\u3002<\/p>\n<p>\u725b\u903c\uff01\u4f30\u8ba1\u662f\u5f00\u9501\u7684\u81ea\u5df1\u5b9a\u5236\u4e86\u4e2a\u5916\u9762\u7684\u9501\u58f3\uff0c\u91cc\u9762\u7528\u4e86\u4e2a\u4ee5\u524d\u64ac\u9501\u5f04\u4e0b\u6765\u7684\u9501\u82af\u7cca\u5f04\u4e86\u4e0b\uff0c\u6536\u4e86\u62111200\uff0c\u4f30\u8ba1\u6210\u672c\u9876\u591a 200\uff0c\u5965\u5229\u7ed9\uff01<\/p>\n<p>\u5c31\u4eca\u5929\u8fd9\u4e00\u4f1a\u513f\uff0c\u6211\u4eec\u5148\u662f\u5728\u5916\u9762\u7b49\u4e861\u4e2a\u5c0f\u65f6\uff08\u524d\u9762\u67091~2\u5bb6\uff09\uff0c\u5f04\u5b8c\u6211\u5bb6\u5306\u5fd9\u53bb\u4e0b\u4e00\u5bb6\uff0c\u4e00\u4e0a\u5348\u81f3\u5c11\u8d5a3\u5343\uff0c\u65e0\u9700\u4ea4\u7a0e\uff0c\u8fd9\u4e00\u4e24\u4e2a\u6708\uff0c\u6708\u5229\u6da6\u5341\u4e07\u59a5\u59a5\u7684\u3002 \u200b\u200b\u200b<\/p><\/blockquote>\n<p>\u4ee5\u540e\u6211\u513f\u5b50\u5b66\u4e60\u4e0d\u597d\uff0c\u6211\u5c31\u8ba9\u4ed6\u5b66\u5f00\u9501\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/1f48a.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=10393\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=10393<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202204\/js-new-function-cover.png\" width=\"160\" height=\"199\" alt=\"\u5361\u901a\u52a8\u7269\u5c01\u9762\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>JS new Function() \u8bed\u6cd5\u770b\u8d77\u6765\u5e73\u5e73\u65e0\u5947 \uff0c\u4f46\u662f\u5176\u5b57\u7b26\u4e32\u4f5c\u4e3a\u51fd\u6570\u4e3b\u4f53\u7684\u7279\u6027\u5927\u6709\u7528\u5904\uff0c\u672c\u6587\u7edd\u5bf9\u4f1a\u8ba9\u4f60\u6709\u6240\u6536\u76ca\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1284],"tags":[1827,1237,1828,371,928,505],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/10393"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=10393"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/10393\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=10393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=10393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=10393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}