{"id":4473,"date":"2021-09-10T21:17:01","date_gmt":"2021-09-10T13:17:01","guid":{"rendered":"https:\/\/t.n-years.com\/?p=4473"},"modified":"2021-09-10T21:24:10","modified_gmt":"2021-09-10T13:24:10","slug":"%e4%bb%8e-run-%e5%92%8c-get-%e6%96%b9%e6%b3%95%e6%b5%85%e6%9e%90-gin-%e7%9a%84%e8%bf%90%e8%a1%8c%e6%9c%ba%e5%88%b6","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=4473","title":{"rendered":"\u4ece Run \u548c GET \u65b9\u6cd5\u6d45\u6790 Gin \u7684\u8fd0\u884c\u673a\u5236"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u521a\u6bd5\u4e1a\u90a3\u4f1a\u513f\uff0c\u4ece\u5408\u79df\u5927\u725b\u7684\u4e66\u67b6\u4e0a\u770b\u5230\u4e00\u672c\u300aSocket \u5957\u63a5\u5b57\u7f16\u7a0b\u300b\uff0c\u5f00\u59cb\u5bf9\u7f51\u7edc\u7f16\u7a0b\u6709\u4e00\u4e9b\u4e86\u89e3\u3002\u540e\u6765\u53c8\u548c\u540c\u5b66\u4e00\u8d77\u505a\u8fc7\u4e00\u4e2a\u7535\u8bdd\u624b\u8868\u7684\u9879\u76ee\uff0c\u5927\u6982\u529f\u80fd\u662f\u7535\u8bdd\u624b\u8868\u7ed9 Server \u7aef\u7a0b\u5e8f\u53d1\u9001\u5fc3\u8df3\u5305\uff0cServer \u7aef\u4f1a\u7ed9\u624b\u8868\u53d1\u4e00\u4e9b\u6307\u4ee4\uff0c\u4e5f\u7b97\u5b9e\u8df5\u4e86\u4e00\u4e0b\u3002\u518d\u540e\u6765\u79fb\u52a8\u4e92\u8054\u7f51\u5174\u8d77\uff0c\u6295\u5165 iOS \u5f00\u53d1\u5927\u6f6e\uff0c\u8fd9\u4e48\u591a\u5e74\u505a\u7684\u9879\u76ee\u4e0e\u670d\u52a1\u7aef\u5f00\u53d1\u57fa\u672c\u516b\u7aff\u5b50\u6253\u4e0d\u7740\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e00. \u5b66\u4e60 Gin \u6846\u67b6\u80cc\u666f\u539f\u56e0<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u6240\u5728\u7684\u56e2\u961f\u867d\u7136\u662f\u5ba2\u6237\u7aef\uff0c\u7531\u4e8e\u56e2\u961f\u89c4\u6a21\u548c\u4e1a\u52a1\u89c4\u6a21\u6bd4\u8f83\u5927\uff0c\u9700\u8981\u4e00\u4e2a\u7ba1\u7406\u7814\u53d1\u6d41\u7a0b\u7684\u5e73\u53f0\uff0c\u8fd9\u4e2a\u5e73\u53f0\u9ebb\u96c0\u867d\u5c0f\u4e94\u810f\u4ff1\u5168\uff0c\u6574\u4e2a\u6d41\u7a0b\u5ba2\u6237\u7aef\u3001\u6301\u7eed\u96c6\u6210\u3001\u670d\u52a1\u7aef\u3001\u524d\u7aef\u90fd\u6709\u6d89\u53ca\u3002\u800c\u7531\u4e8e\u670d\u52a1\u7aef\u4e3b\u529b\u5f00\u53d1\u8f6c\u5c97\uff0c\u6240\u4ee5\u5f88\u591a\u6280\u672f\u65b9\u6848\u7684\u51b3\u7b56\u5c31\u9700\u8981\u6211\u53c2\u4e0e\uff0c\u4e86\u89e3\u4e0b\u5c31\u975e\u5e38\u6709\u5fc5\u8981\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u670d\u52a1\u7aef\u9879\u76ee\u7528\u7684 Go \u8bed\u8a00\u5f00\u53d1\uff0c\u5f00\u53d1\u6846\u67b6\u7528\u7684\u662f\u516c\u53f8\u5185\u90e8\u7684\u5f00\u6e90\u65b9\u6848\uff0c\u7ecf\u8fc7 3 \u4eba 1 \u4e2a\u5b63\u5ea6\u7684\u5f00\u53d1\uff0c\u9879\u76ee\u5df2\u7ecf\u6709\u4e00\u4e9b\u4f9d\u8d56\uff0c\u5f15\u5165\u4e86\u5f88\u591a\u6846\u67b6\uff0c\u60f3\u8c03\u8bd5\u3001\u8fd0\u884c\u3001\u6216\u4e86\u89e3\u4e00\u4e0b\u6846\u67b6\u7684\u8fd0\u884c\u673a\u5236\u6709\u4e00\u5b9a\u6210\u672c\u3002\u56e0\u6b64\u5728\u770b\u5b8c\u4e24\u904d Go \u8bed\u8a00\u7684\u57fa\u7840\u77e5\u8bc6\u540e\uff0c\u627e\u4e86\u4e1a\u5185\u6bd4\u8f83\u6d41\u884c Web \u6846\u67b6 Gin \u7814\u7a76\u4e00\u4e0b\uff0c\u8fd9\u4e9b\u6846\u67b6\u90fd\u662f\u89e3\u51b3\u540c\u6837\u7684\u95ee\u9898\uff0c\u5b83\u4eec\u4e4b\u95f4\u4e5f\u80af\u5b9a\u6709\u5f88\u591a\u5171\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e8c. \u5e26\u7740\u95ee\u9898\u5b66\u4e60\uff1aGin \u8bf7\u6c42\u5904\u7406\u7684\u5165\u53e3\u5728\u54ea\u91cc\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Gin \u6846\u67b6\u786e\u5b9e\u7b80\u7ec3\uff0c\u77ed\u77ed\u51e0\u884c\u4ee3\u7801\u5c31\u53ef\u4ee5\u521b\u5efa\u54cd\u5e94\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u4ee3\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func main() {\n\tg := gin.Default()\n\t\n\tg.GET(\"\/\", func(c *gin.Context) {\n\t\tc.String(http.StatusOK, \"Hello Wrold!\")\n\t})\n\n\tg.Run(\":\" + \"8088\")\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u601d\u8def\u8d77\u70b9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b80\u7ec3\u4ee3\u7801\u80cc\u540e\uff0c\u662f\u6846\u67b6\u5bf9\u590d\u6742\u5ea6\u7684\u5c01\u88c5\u3002\u770b\u5230\u8fd9\u6837\u7684\u4ee3\u7801\uff0c\u6211\u60f3\u5230\u7684\u7b2c\u4e00\u4e2a\u95ee\u9898\u662f\uff1a\"Gin \u5982\u4f55\u5904\u7406\u8bf7\u6c42\u7684\u5206\u53d1\uff1f\"\uff0c\u7531\u4e8e\u4e4b\u524d\u770b\u8fc7\u300aSocket \u5957\u63a5\u5b57\u7f16\u7a0b\u300b\uff0c\u81ea\u7136\u60f3\u5230\u5982\u679c\u81ea\u5df1\u4ece\u5934\u5f00\u59cb\u5199\u4e00\u4e2a\u8fd9\u6837\u7684\u670d\u52a1\u7aef\u5904\u7406\u7a0b\u5e8f\u5e94\u8be5\u600e\u4e48\u5199\uff1fGin \u6846\u67b6\u6e90\u7801\u5e94\u8be5\u4ece\u54ea\u91cc\u5f00\u59cb\u770b\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"656\" height=\"732\" src=\"https:\/\/t.n-years.com\/wp-content\/uploads\/2021\/09\/image.png\" alt=\"\" class=\"wp-image-4490\" srcset=\"https:\/\/t.n-years.com\/wp-content\/uploads\/2021\/09\/image.png 656w, https:\/\/t.n-years.com\/wp-content\/uploads\/2021\/09\/image-269x300.png 269w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><figcaption>\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u901a\u4fe1\u6a21\u578b\uff0c\u56fe\u7247\u6765\u81ea<a href=\"https:\/\/segmentfault.com\/a\/1190000014044351\">segmentfault<\/a><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u901a\u4fe1\u6a21\u578b\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u670d\u52a1\u7aef\u5904\u7406\u8bf7\u6c42\u90fd\u662f\u5728 <strong>listen() <\/strong>\u8fd9\u91cc\u5f00\u542f\u76d1\u542c\u3002\u56e0\u6b64\u9996\u5148\u8981\u627e\u5230 <strong>listen()<\/strong> \u65b9\u6cd5\uff0c\u53e6\u5916\u4ece\u8f6f\u4ef6\u5f00\u53d1\u7684\u5206\u5c42\u6a21\u578b\u6765\u7406\u89e3\uff0c\u628a<strong>\u5e94\u7528\u6846\u67b6<\/strong> \u548c <strong>\u7cfb\u7edf\u6846\u67b6<\/strong> \u7684\u5b9e\u73b0\u533a\u5206\u5f00\uff0c\u6709\u5229\u4e8e\u628a\u77e5\u8bc6\u5206\u89e3\u5206\u5757\u5b66\u4e60\uff0c\u4e0d\u5173\u6ce8\u7684\u4e00\u90e8\u5206\u6682\u4e14\u5f53\u505a\u9ed1\u76d2\u5b50\uff0c\u4e86\u89e3\u5c42\u4e0e\u5c42\u4e4b\u95f4\u5982\u4f55\u4ea4\u4e92\u5373\u53ef\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u6211\u4eec\u6765\u770b\u770b\u793a\u4f8b\u4e2d mian \u65b9\u6cd5\u8c03\u7528\u7684\u51e0\u4e2a\u5b50\u65b9\u6cd5\u539f\u578b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func Default() *Engine<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>gin.Default() \u8fd4\u56de\u4e00\u4e2a *Engine \u7c7b\u578b\u3002<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>func (group *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) IRoutes<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u539f\u578b\u63a5\u6536\u5bf9\u8c61\u4e3a *RouterGroup \u7684 GET \u65b9\u6cd5\u3002\u6ce8\u610f\u793a\u4f8b\u91cc\u5b83\u7528\u7684 Default() \u65b9\u6cd5\u7684\u8fd4\u56de\u503c\u53bb\u63a5\u6536\u7684\uff0c\u800cDefault() \u8fd4\u56de\u503c \u662f *Engine \u7c7b\u578b\u3002\u56e0\u6b64 *Engine \u7c7b\u578b\u4e5f\u662f *RouterGroup \u7c7b\u578b\uff0c\u8fd9\u4e2a\u540e\u9762\u6211\u4eec\u7ed3\u5408\u6e90\u7801\u8bf4\u660e Gin \u6846\u67b6\u662f\u600e\u4e48\u505a\u5230\u7684\u3002<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>func (engine *Engine) Run(addr ...string) (err error)<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Run \u65b9\u6cd5\u7684\u63a5\u6536\u5bf9\u8c61 \u662f *Engine \u7c7b\u578b<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u4ece Run \u65b9\u6cd5\u8bf4\u8d77 - \u5bfb\u627e\u8bf7\u6c42\u5904\u7406\u5165\u53e3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u6e90\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func (engine *Engine) Run(addr ...string) (err error) {\n\tdefer func() { debugPrintError(err) }()\n\n\ttrustedCIDRs, err := engine.prepareTrustedCIDRs()\n\tif err != nil {\n\t\treturn err\n\t}\n\tengine.trustedCIDRs = trustedCIDRs\n\taddress := resolveAddress(addr)\n\tdebugPrint(\"Listening and serving HTTP on %s\\n\", address)\n\terr = http.ListenAndServe(address, engine)\n\treturn\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u9762\u7684\u5173\u952e\u65b9\u6cd5\u662f <strong>http.ListenAndServe<\/strong> \u65b9\u6cd5\uff0c\u5b83\u5c5e\u4e8e net\/http \u5305\u91cc\u7684\u4e00\u4e2a\u65b9\u6cd5\uff0c\u4e5f\u5c31\u662f\u6211\u4eec\u524d\u9762\u8bf4\u7684 <strong>\u7cfb\u7edf\u6846\u67b6 <\/strong>\u7684\u90e8\u5206\u3002\u8fd9\u4e2a\u65b9\u6cd5\u5c31\u662f Gin <strong>\u5e94\u7528\u6846\u67b6<\/strong> \u548c Go <strong>\u7cfb\u7edf\u6846\u67b6<\/strong> \u7684\u4ea4\u4e92\u63a5\u53e3\u3002Gin \u5411 <strong>http.ListenAndServe<\/strong> \u65b9\u6cd5\u4f20\u5165\u4e86 \u5730\u5740 \u548c <strong>engine<\/strong> \u4e24\u4e2a\u53c2\u6570\uff08\u5730\u5740\u4e0d\u662f\u6211\u4eec\u5173\u6ce8\u7684\u91cd\u70b9\uff0c\u5148\u5ffd\u7565\uff09\u3002\u6211\u4eec\u6765\u770b\u770b <strong>http.ListenAndServe<\/strong> \u7684\u65b9\u6cd5\u539f\u5f62\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func ListenAndServe(addr string, handler Handler) error<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u53ef\u4ee5\u770b\u5230 <strong>ListenAndServe<\/strong> \u8981\u6c42\u4f20\u5165\u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a Handler\uff0c\u800c Gin \u4f20\u5165\u7684\u662f <strong>*Engine<\/strong>\uff0c\u5b83\u4eec\u4e4b\u95f4\u662f\u4ec0\u4e48\u5173\u7cfb\u4e86\uff0c\u6211\u4eec\u6765\u770b\u770b Handler \u7684\u539f\u578b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type Handler interface {\n\tServeHTTP(ResponseWriter, *Request)\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u53ef\u4ee5\u770b\u5230 Handler \u662f\u4e00\u4e2a\u63a5\u53e3\u7c7b\u578b\uff0cGo \u7684\u63a5\u53e3\u7c7b\u578b\u5173\u7cfb\u6bd4\u8f83\u677e\u6563\uff0c\u57fa\u672c\u4e0a\u53ef\u4ee5\u7406\u89e3\u662f\u9760 <strong>\u540c\u540d\u65b9\u6cd5<\/strong> \u7ef4\u7cfb\u7c7b\u578b\u548c\u63a5\u53e3\u95f4\u7684\u5173\u7cfb\uff0c\u8fd9\u6837\u7684\u597d\u5904\u662f\u53ef\u4ee5\u51cf\u5c11\u7f16\u8bd1\u65f6\u4f9d\u8d56\u3002\u7531\u6b64\u6211\u4eec\u77e5\u9053 \u5e94\u8be5\u6709\u4e00\u4e2a\u63a5\u6536\u7c7b\u578b\u4e3a <strong>*Engine<\/strong> \u7684 <strong>ServeHTTP<\/strong> \u65b9\u6cd5\u3002\u641c\u7d22\u6e90\u7801\u5370\u8bc1\u4e86\u8fd9\u4e2a\u63a8\u65ad\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tc := engine.pool.Get().(*Context)\n\tc.writermem.reset(w)\n\tc.Request = req\n\tc.reset()\n\n\tengine.handleHTTPRequest(c)\n\n\tengine.pool.Put(c)\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u81f3\u6b64\uff0c\u6211\u4eec\u627e\u5230\u4e86 Gin \u4e2d\u8bf7\u6c42\u5904\u7406\u7684\u5165\u53e3\u3002\u6bcf\u4e2a\u8bf7\u6c42\u7684\u5904\u7406\u90fd\u4f1a \u8d70 <strong>engine.handleHTTPRequest<\/strong> \u65b9\u6cd5\u3002\u539f\u578b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func (engine *Engine) handleHTTPRequest(c *Context)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. GET \u65b9\u6cd5\uff1aRouterGroup<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u524d\u6587\u6211\u4eec\u4e86\u89e3\u5230 GET \u65b9\u6cd5\u539f\u578b\u4e2d\uff0c\u63a5\u6536\u5bf9\u8c61\u662f *RouterGroup\uff0c \u800c\u793a\u4f8b\u4e2d GET \u65b9\u6cd5\u63a5\u6536\u5bf9\u8c61\u5374\u662f *Engine\uff0c\u770b\u5230 Engine \u7c7b\u578b\u7684\u5b9a\u4e49\u89e3\u51b3\u4e86\u8fd9\u4e00\u7591\u60d1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type Engine struct {\n\tRouterGroup\n        ....\n}\n\ntype RouterGroup struct {\n\tHandlers HandlersChain\n\tbasePath string\n\tengine   *Engine\n\troot     bool\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u4e00\u4e2a\u7ed3\u6784\u4f53\u5d4c\u5957\u7684\u7528\u6cd5\uff0cEngine \u7c7b\u578b\u5934\u90e8\u662f\u4e00\u4e2a RouterGroup\u7c7b\u578b\uff0c\u56e0\u6b64Engine \u7c7b\u578b\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u4ee5\u5f53\u505a RouterGroup \u6765\u7528\uff0cRouterGroup \u91cc\u4e5f\u6709 *Engine \u7c7b\u578b\uff0c\u6240\u4ee5\u5b83\u4e24\u662f\u4e92\u76f8\u5f15\u7528\uff0c\u4e92\u76f8\u67e5\u627e\u3002\u4ee5\u4e0b\u662f GET \u65b9\u6cd5\u7684\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func (group *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) IRoutes {\n\treturn group.handle(http.MethodGet, relativePath, handlers)\n}\n\nroutergroup.go<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>func (group *RouterGroup) handle(httpMethod, relativePath string, handlers HandlersChain) IRoutes {\n\tabsolutePath := group.calculateAbsolutePath(relativePath)\n\thandlers = group.combineHandlers(handlers)\n\tgroup.engine.addRoute(httpMethod, absolutePath, handlers)\n\treturn group.returnObj()\n}\n\nroutergroup.go<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>func (engine *Engine) addRoute(method, path string, handlers HandlersChain) {\n\tassert1(path&#91;0] == '\/', \"path must begin with '\/'\")\n\tassert1(method != \"\", \"HTTP method can not be empty\")\n\tassert1(len(handlers) > 0, \"there must be at least one handler\")\n\n\tdebugPrintRoute(method, path, handlers)\n\n\troot := engine.trees.get(method)\n\tif root == nil {\n\t\troot = new(node)\n\t\troot.fullPath = \"\/\"\n\t\tengine.trees = append(engine.trees, methodTree{method: method, root: root})\n\t}\n\troot.addRoute(path, handlers)\n\n\t\/\/ Update maxParams\n\tif paramsCount := countParams(path); paramsCount > engine.maxParams {\n\t\tengine.maxParams = paramsCount\n\t}\n}\n\ngin.go<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ecf\u8fc7\u8fd9\u5c42\u5c42\u8c03\u7528\uff0c\u7ed3\u5408 <strong>handleHTTPRequest<\/strong> \u7684\u5904\u7406\u8fc7\u7a0b\uff0c\u6700\u7ec8\u6211\u4eec\u77e5\u9053\u6240\u6709\u7684\u8bf7\u6c42\u90fd\u4f1a\u88ab\u52a0\u5230 engine.trees \u4e0a\u3002\u6709\u65f6\u95f4\u6211\u4eec\u518d\u6765\u5206\u6790\u8fd9\u4e00\u90e8\u5206\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f88\u4e45\u6ca1\u8bfb\u6846\u67b6\u6e90\u7801\uff0c\u6ca1\u60f3\u5230\u8fd9\u6b21\u5c45\u7136\u8bfb\u4e86\u4e00\u4e2a\u670d\u52a1\u7aef\u6846\u67b6\u3002\u4e3b\u52a8\u601d\u8003\u3001\u4e3b\u52a8\u5206\u6790\u7684\u8fc7\u7a0b\uff0c\u611f\u89c9\u6709\u6536\u83b7\u3002\u5185\u5bb9\u867d\u5c11\uff0c\u4e5f\u662f\u7ba1\u4e2d\u7aa5\u8c79\u5427\u3002<\/p>\n\n\n\n<p class=\"has-text-align-right wp-block-paragraph\"><span class=\"has-inline-color has-cyan-bluish-gray-color\">2021 \u5e74 9 \u6708 10\u65e5\uff08\u5468\u4e94\uff09\uff0c\u56e2\u5efa\u4e0b\u73ed\u540e\uff0c\u4e8e 19\uff1a00~21\uff1a16 \u5b8c\u6210\u3002<\/span> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521a\u6bd5\u4e1a\u90a3\u4f1a\u513f\uff0c\u4ece\u5408\u79df\u5927\u725b\u7684\u4e66\u67b6\u4e0a\u770b\u5230\u4e00\u672c\u300aSocket \u5957\u63a5\u5b57\u7f16\u7a0b\u300b\uff0c\u5f00\u59cb\u5bf9\u7f51\u7edc\u7f16\u7a0b\u6709\u4e00\u4e9b\u4e86\u89e3\u3002\u540e\u6765\u53c8\u548c\u540c\u5b66\u4e00&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=4473\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-4473","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/4473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4473"}],"version-history":[{"count":76,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/4473\/revisions"}],"predecessor-version":[{"id":4550,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/4473\/revisions\/4550"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}