{"id":1946,"date":"2021-08-03T15:04:27","date_gmt":"2021-08-03T07:04:27","guid":{"rendered":"https:\/\/egonlin.com\/?p=1946"},"modified":"2022-04-26T13:53:56","modified_gmt":"2022-04-26T05:53:56","slug":"%e5%a4%8d%e5%90%88%e7%b1%bb%e5%9e%8b%e4%b9%8b%e7%bb%93%e6%9e%84%e4%bd%93","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=1946","title":{"rendered":"\u590d\u5408\u7c7b\u578b\u4e4b\u7ed3\u6784\u4f53"},"content":{"rendered":"<h1>\u7ed3\u6784\u4f53struct<\/h1>\n<h2>\u4e00 \u7ed3\u6784\u4f53\u4ecb\u7ecd<\/h2>\n<p>\u200b   <strong>\u4ec0\u4e48\u662fstruct\uff1f<\/strong><\/p>\n<p>\u200b   struct\u662fgo\u8bed\u8a00\u4e3a\u6211\u4eec\u63d0\u4f9b\u7684\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7684\u4e00\u79cd\u7c7b\u578b\uff0c\u8be5\u7c7b\u578b\u53ef\u4ee5\u5c01\u88c5\u591a\u4e2a\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u53ef\u4ee5\u7528\u6765\u5b58\u653e\u4e00\u4e2a\u4e8b\u7269\u7684\u4e0d\u540c\u5c5e\u6027<\/p>\n<p>\u200b   <strong>\u4e3a\u4f55\u8981\u6709struct\uff1f<\/strong><\/p>\n<p>\u200b   \u539f\u56e0\u6709\u4e8c\uff1a<\/p>\n<p>\u200b   1\u3001Go\u8bed\u8a00\u5185\u7f6e\u7684\u57fa\u7840\u6570\u636e\u7c7b\u578b\u53ea\u80fd\u7528\u6765\u8bb0\u5f55\u4e00\u4e2a\u503c\uff0c\u590d\u5408\u7c7b\u578b\u6570\u7ec4\u3001\u5207\u7247\u3001map\u7b49\u4e5f\u867d\u7136\u80fd\u5b58\u591a\u4e2a\u503c\uff0c\u4f46\u591a\u4e2a\u503c\u90fd\u5fc5\u987b\u662f\u540c\u4e00\u5c5e\u6027\u7684\uff0c\u5982\u679c\u6211\u4eec\u60f3\u628a\u4e00\u4e2a\u4e8b\u7269\u7684\u591a\u4e2a\u4e0d\u540c\u5c5e\u6027\u90fd\u8bb0\u5f55\u4e0b\u6765\uff0c\u6211\u4eec\u4e4b\u524d\u5b66\u8fc7\u7684\u5185\u7f6e\u7c7b\u578b\u90fd\u65e0\u6cd5\u6ee1\u8db3\u9700\u6c42\uff0c\u6b64\u65f6\u5c31\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2a\u7ed3\u6784\u4f53<code>struct<\/code>\u7c7b\u578b\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u200b   2\u3001Go\u8bed\u8a00\u4e2d\u901a\u8fc7<code>struct<\/code>\u6765\u5b9e\u73b0\u9762\u5411\u5bf9\u8c61\u3002Go\u8bed\u8a00\u4e2d\u6ca1\u6709\u201c\u7c7b\u201d\u7684\u6982\u5ff5(\u6216\u8005\u8bf4\u7ed3\u6784\u4f53struct\u5145\u5f53\u7684\u5c31\u662f\u7c7b\u7684\u4f5c\u7528)\uff0c\u4e5f\u4e0d\u652f\u6301\u201c\u7c7b\u201d\u7684\u7ee7\u627f\u7b49\u9762\u5411\u5bf9\u8c61\u7684\u6982\u5ff5\u3002Go\u8bed\u8a00\u4e2d\u901a\u8fc7\u7ed3\u6784\u4f53\u7684\u5185\u5d4c\u518d\u914d\u5408\u63a5\u53e3\u4ee5\u8fbe\u5230\u6bd4\u9762\u5411\u5bf9\u8c61\u66f4\u9ad8\u7684\u6269\u5c55\u6027\u548c\u7075\u6d3b\u6027\u3002<\/p>\n<h2>\u4e8c \u77e5\u8bc6\u50a8\u5907<\/h2>\n<h3>2.1 \u81ea\u5b9a\u4e49\u7c7b\u578b<\/h3>\n<p>Go\u8bed\u8a00\u4e2d\u53ef\u4ee5\u4f7f\u7528<code>type<\/code>\u5173\u952e\u5b57\u6765\u5b9a\u4e49\u81ea\u5b9a\u4e49\u7c7b\u578b\u3002\u6211\u4eec\u53ef\u4ee5\u57fa\u4e8ego\u8bed\u8a00\u5185\u7f6e<code>string<\/code>\u3001<code>\u6574\u578b<\/code>\u3001<code>\u6d6e\u70b9\u578b<\/code>\u3001<code>\u5e03\u5c14<\/code>\u7b49\u57fa\u672c\u7c7b\u578b\u6765\u81ea\u5b9a\u4e49\u6211\u4eec\u81ea\u5df1\u7684\u7c7b\u578b\uff0c\u4e5f\u53ef\u4ee5\u57fa\u4e8estruct\u6765\u5b9a\u4e49\uff0c\u4f46\u65e0\u8bba\u662f\u57fa\u4e8e\u4ec0\u4e48\uff0c\u6211\u4eec\u90fd\u662f\u521b\u9020\u4e86\u4e00\u5168\u65b0\u7684\u7c7b\u578b\uff0c\u65b0\u7c7b\u578b\u5177\u5907\u539f\u7c7b\u578b\u7684\u4e00\u4e9b\u7279\u6027\uff0c\u4f46\u5b83\u4eec\u662f\u622a\u7136\u4e0d\u540c\u7684\u4e24\u79cd\u7c7b\u578b<\/p>\n<pre><code class=\"language-go\">type NewInt int  \/\/ NewInt\u5177\u5907int\u7c7b\u578b\u7684\u7279\u6027\uff0c\u4f46\u5b83\u4eec\u662f\u4e24\u79cd\u7c7b\u578b\n\nvar x NewInt = 10\nvar y int = 10\n\nfmt.Println(x+y) \/\/ panic: (mismatched types NewInt and int)<\/code><\/pre>\n<h3>2.2 \u7c7b\u578b\u522b\u540d<\/h3>\n<p>\u7c7b\u578b\u522b\u540d\u662f<code>Go1.9<\/code>\u7248\u672c\u6dfb\u52a0\u7684\u65b0\u529f\u80fd\u3002\u7c7b\u578b\u522b\u540d\u53ea\u662f\u7ed9\u67d0\u4e2a\u7c7b\u578b\u8d77\u4e86\u4e00\u4e2a\u522b\u540d\uff0c\u5e76\u6ca1\u6709\u521b\u5efa\u65b0\u7c7b\u578b\uff0c\u4e8b\u5b9e\u4e0a\uff0c\u7c7b\u578b\u7684\u522b\u540d\u4e5f\u53ea\u662f\u5728\u4ee3\u7801\u91cc\u7684\u6982\u5ff5\uff0c\u5728\u7f16\u8bd1\u5b8c\u6210\u540e\u6240\u6709\u7684\u522b\u540d\u90fd\u4f1a\u88ab\u8f6c\u6362\u6210\u5176\u771f\u6b63\u7684\u7c7b\u578b<\/p>\n<pre><code class=\"language-go\">type MyInt = int\n\nvar a MyInt = 10  \n\nfmt.Printf(&quot;%T&quot;,a)  \/\/ \u6253\u5370a\u7684\u7c7b\u578b\u5c31\u662fint<\/code><\/pre>\n<h2>\u4e09 \u81ea\u5b9a\u4e49\u7ed3\u6784\u4f53\u7c7b\u578b<\/h2>\n<p>\u4f7f\u7528<code>type<\/code>\u548c<code>struct<\/code>\u5173\u952e\u5b57\u6765\u5b9a\u4e49\u7ed3\u6784\u4f53\uff0c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-go\">type \u7c7b\u578b\u540d struct {\n    \u5b57\u6bb5\u540d \u5b57\u6bb5\u7c7b\u578b\n    \u5b57\u6bb5\u540d \u5b57\u6bb5\u7c7b\u578b\n    \u2026\n}\n\n\/\/ \u6ce8\u610f\uff1a\n\u7c7b\u578b\u540d\uff1a\u6216\u79f0\u7ed3\u6784\u4f53\u540d\uff0c\u5728\u540c\u4e00\u4e2a\u5305\u5185\u4e0d\u80fd\u91cd\u590d\u3002\n\u5b57\u6bb5\u540d\uff1a\u6216\u79f0\u5c5e\u6027\u540d\uff0c\u7ed3\u6784\u4f53\u4e2d\u7684\u5b57\u6bb5\u540d\u5fc5\u987b\u552f\u4e00\u3002\n\u5b57\u6bb5\u7c7b\u578b\uff1a\u7ed3\u6784\u4f53\u5b57\u6bb5\u7684\u5177\u4f53\u7c7b\u578b\u3002<\/code><\/pre>\n<p>\u793a\u4f8b<\/p>\n<pre><code class=\"language-go\">type Person struct {\n    name     string\n    age      int\n    sex      string\n    city     string\n    hobbbies []string\n    sanwei   map[string]float64\n}\n\n\/\/ \u7c7b\u578b\u76f8\u540c\u7684\u5b57\u6bb5\u4e5f\u53ef\u4ee5\u5199\u5728\u540c\u4e00\u884c\ntype Person struct {\n    name, sex, city string \/\/ \u5199\u5728\u4e00\u884c\n    age             int\n    hobbbies        []string\n    sanwei          map[string]float64\n}<\/code><\/pre>\n<h2>\u56db \u7ed3\u6784\u4f53\u201c\u5b9e\u4f8b\u5316\u201d<\/h2>\n<p>\u987b\u77e5\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u7ed3\u6784\u4f53\u672c\u8d28\u5c31\u662f\u4e00\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u58f0\u660e\u4e00\u4e2a\u7ed3\u6784\u4f53\u7c7b\u578b\u7684\u53d8\u91cf\u79f0\u4e4b\u4e3a\u7ed3\u6784\u4f53\u7684\u5b9e\u4f8b\u5316\uff0c\u5982\u4e0b<\/p>\n<pre><code class=\"language-go\">var p1 Person  \/\/ \u96f6\u503c\u586b\u5145\u7ed3\u6784\u4f53\u5e76\u628a\u7ed3\u6784\u4f53\u7684\u503c\u8d4b\u503c\u7ed9p1\n\nfmt.Printf(&quot;%T\\n&quot;,p1)  \/\/ main.Person<\/code><\/pre>\n<p>\u53ea\u6709\u5f53\u7ed3\u6784\u4f53\u5b9e\u4f8b\u5316\u65f6\uff0c\u624d\u4f1a\u771f\u6b63\u5730\u5206\u914d\u5185\u5b58\uff0c\u5206\u914d\u5185\u5b58\u4e4b\u540e\u624d\u80fd\u4f7f\u7528\u7ed3\u6784\u4f53\u7684\u5b57\u6bb5\uff0c\u4f46\u662f\u4e0a\u8ff0\u5b9e\u4f8b\u5316\u7684\u8fc7\u7a0b\u90fd\u662f\u7528\u96f6\u503c\u586b\u5145\u7ed3\u6784\u4f53\uff0c\u6b64\u65f6\u8bbf\u95ee\u5230\u7684\u5b57\u6bb5\u503c\u90fd\u662f\u521d\u59cb\u7684\u96f6\u503c<\/p>\n<pre><code class=\"language-go\">\/\/ \u4f7f\u7528.\u64cd\u4f5c\u7b26\u8bbf\u95ee\u5b57\u6bb5\/\u5c5e\u6027\nfmt.Println(p1.name)            \/\/ \u7a7a\u4e32\nfmt.Println(p1.sex)             \/\/ \u7a7a\u4e32\nfmt.Println(p1.age)             \/\/ 0\nfmt.Println(p1.hobbbies == nil) \/\/ true\nfmt.Println(p1.sanwei == nil)   \/\/ true<\/code><\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u5728\u5b9e\u4f8b\u5316\u540e\uff0c\u518d\u4e3a\u5b9e\u4f8b\u8d4b\u503c\u5c5e\u6027\uff0c\u5982\u4e0b<\/p>\n<pre><code class=\"language-go\">\/\/ p1\u3001p2\u3001p3\u9664\u4e86\u7c7b\u578b\u4e0a\u4e0d\u540c\u4e4b\u5916\uff0c\u5176\u4ed6\u7684\u7528\u6cd5\u5b8c\u5168\u4e00\u81f4\np1.name = &quot;egon&quot;\np1.age = 18\np1.sex = &quot;male&quot;\np1.city = &quot;Shanghai&quot;\np1.hobbbies = []string{&quot;play&quot;, &quot;music&quot;, &quot;read&quot;}\np1.sanwei = map[string]float64{\n    &quot;xw&quot;: 200.3,\n    &quot;yw&quot;: 30.3,\n    &quot;tw&quot;: 200.5,\n}<\/code><\/pre>\n<p>\u4e5f\u5b8c\u5168\u53ef\u4ee5\u5728\u5b9e\u4f8b\u5316\u7684\u540c\u65f6\u4e3a\u5176\u5c5e\u6027\u8d4b\u503c\uff0c\u8d4b\u503c\u65b9\u5f0f\u6709\u4e24\u79cd<\/p>\n<pre><code class=\"language-go\">\/\/ \u65b9\u5f0f\u4e00\uff1a\u952e\u503c\u65b9\u5f0f\n\/\/ \u7279\u70b9\uff1a\n\/\/ (1) \u6307\u5b9akey\u548cvalue\uff0c\u6307\u540d\u9053\u59d3\u5730\u8d4b\u503c,\u4e0d\u4f9d\u8d56\u58f0\u660e\u7684\u5b57\u6bb5\u987a\u5e8f \n\/\/ (2) \u4e0d\u5fc5\u4e3a\u6240\u6709\u5b57\u6bb5\/\u5c5e\u6027\u8d4b\u503c\uff0c\u6ca1\u6709\u6307\u5b9a\u521d\u59cb\u503c\u7684\u5b57\u6bb5\u7684\u503c\u5c31\u662f\u8be5\u5b57\u6bb5\u7c7b\u578b\u7684\u96f6\u503c\u3002\nvar p1 Person = Person{\n    name:     &quot;egon&quot;,\n    hobbbies: []string{&quot;read&quot;, &quot;music&quot;},\n    sanwei: map[string]float64{\n        &quot;xw&quot;: 200.3,\n        &quot;yw&quot;: 30.3,\n        &quot;tw&quot;: 200.5,\n    },\n}\n\nfmt.Println(p1.sanwei[&quot;xw&quot;]) \nfmt.Println(p1) \/\/ {egon 0   [read music] map[tw:200.5 xw:200.3 yw:30.3]}\n\n\/\/ \u65b9\u5f0f\u4e8c\uff1a\u5217\u8868\u65b9\u5f0f\n\/\/ \u7279\u70b9\uff1a\n\/\/ (1) \u76f4\u63a5\u5199\u503c\uff0c\u6309\u7167\u4f4d\u7f6e\u8d4b\u503c\uff0c\u4e25\u683c\u4f9d\u8d56\u58f0\u660e\u7684\u5b57\u6bb5\u987a\u5e8f\n\/\/ (2) \u5fc5\u987b\u4e3a\u6240\u6709\u5b57\u6bb5\/\u5c5e\u6027\u8d4b\u503c\n\/\/ (3) \u8be5\u65b9\u5f0f\u4e0d\u80fd\u4e0e\u65b9\u5f0f\u4e00\u6df7\u7528\nvar p1 Person = Person{\n    &quot;egon&quot;,\n    18,\n    &quot;male&quot;,\n    &quot;Shanghai&quot;,\n    []string{&quot;read&quot;, &quot;music&quot;},\n    map[string]float64{\n        &quot;xw&quot;: 200.3,\n        &quot;yw&quot;: 30.3,\n        &quot;tw&quot;: 200.5,\n    },\n}<\/code><\/pre>\n<p>\u9488\u5bf9\u4e34\u65f6\u4f7f\u7528\u7684\u573a\u666f\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9a\u4e49\u533f\u540d\u7ed3\u6784\u4f53\uff0c\u5373\u65e0\u9700\u4f7f\u7528type\u5b9a\u4e49\u7ed3\u6784\u4f53\u7c7b\u578b\uff0c\u800c\u76f4\u63a5\u5728var\u4e2d\u4f7f\u7528<\/p>\n<pre><code class=\"language-go\">var info struct {\n    name string\n    age  int\n    sex  string\n}\n\ninfo.name = &quot;egon&quot;\ninfo.age = 18\ninfo.sex = &quot;male&quot;<\/code><\/pre>\n<p>\u7ec3\u4e60\uff1a\u521b\u9020\u4e00\u4e2a\u4e66\u7c4d\u7684\u7ed3\u6784\u4f53\uff0c\u5b9e\u4f8b\u5316\u51fa\u591a\u672c\u4e66\uff0c\u5e76\u6253\u5370\u4e66\u7c4d\u4fe1\u606f<\/p>\n<pre><code class=\"language-go\">package main\n\nimport &quot;fmt&quot;\n\ntype Books struct {\n    name string\n    author string\n    book_id int\n}\n\nfunc main() {\n    var Book1 Books        \/* \u58f0\u660e Book1 \u4e3a Books \u7c7b\u578b *\/\n    var Book2 Books        \/* \u58f0\u660e Book2 \u4e3a Books \u7c7b\u578b *\/\n\n    \/* book 1 \u63cf\u8ff0 *\/\n    Book1.name = &quot;Go \u8bed\u8a00\u4ece\u5165\u95e8\u5230\u6210\u4ed9&quot;\n    Book1.author = &quot;\u949f\u9997&quot;\n    Book1.book_id = 4578\n\n    \/* book 2 \u63cf\u8ff0 *\/\n    Book2.name = &quot;Python \u8bed\u8a00\u4ece\u5165\u95e8\u5230\u5165\u575f&quot;\n    Book2.author = &quot;\u5f20\u4e09\u4e30&quot;\n    Book2.book_id = 4579\n\n    \/* \u6253\u5370 Book1 \u4fe1\u606f *\/\n    fmt.Printf( &quot;Book 1 name : %s\\n&quot;, Book1.name)\n    fmt.Printf( &quot;Book 1 author : %s\\n&quot;, Book1.author)\n    fmt.Printf( &quot;Book 1 book_id : %d\\n&quot;, Book1.book_id)\n\n    \/* \u6253\u5370 Book2 \u4fe1\u606f *\/\n    fmt.Printf( &quot;Book 2 name : %s\\n&quot;, Book2.name)\n    fmt.Printf( &quot;Book 2 author : %s\\n&quot;, Book2.author)\n    fmt.Printf( &quot;Book 2 book_id : %d\\n&quot;, Book2.book_id)\n}<\/code><\/pre>\n<h2>\u4e94 \u7ed3\u6784\u4f53\u6307\u9488<\/h2>\n<p>\u7ed3\u6784\u4f53\u4e3a\u503c\u7c7b\u578b\uff0c\u6765\u56de\u4f20\u9012\u7ed3\u6784\u4f53\u7684\u5f00\u9500\u4f1a\u6bd4\u8f83\u5927\uff0c\u6b64\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u58f0\u660e\u7ed3\u6784\u4f53\u6307\u9488<\/p>\n<pre><code class=\"language-go\">var p2 *Person\nfmt.Println(p2 == nil)  \/\/ true<\/code><\/pre>\n<p>p2\u4e3anil\uff0c\u672a\u5f00\u8f9f\u7a7a\u95f4\uff0c\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528\uff0c\u9700\u8981\u4e3a\u5176\u5f00\u8f9f\u597d\u5185\u5b58\u7a7a\u95f4\uff0c\u6709\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f<\/p>\n<pre><code class=\"language-go\">\/\/ 1\u3001\u58f0\u660e\u7ed3\u6784\u4f53\u6307\u9488\uff1a\u57fa\u4e8enew\u5f00\u8f9f\u597d\u5185\u5b58\u7a7a\u95f4\uff0cp3\u4e0d\u4e3anil\np3:=new(Person)\nfmt.Println(p3 == nil)  \/\/ false\n\n\/\/ 2\u3001\u58f0\u660e\u7ed3\u6784\u4f53\u6307\u9488\uff1a\np4:=&amp;Person{}  \/\/ \u4e0enew\u7b49\u540c\nfmt.Println(p4 == nil)  \/\/ false\n\n\u8be5\u65b9\u5f0f\u53ef\u4ee5\u5728\u58f0\u660e\u7684\u540c\u65f6\u4e3a\u5b57\u6bb5\u8d4b\u503c\uff0c\u5982\u4e0b\np4 = &amp;Person{\n    name: &quot;egon&quot;,\n    age: 18,\n}<\/code><\/pre>\n<p>\u901a\u8fc7\u7ed3\u6784\u4f53\u6307\u9488\u4e3a\u5b57\u6bb5\u8d4b\u503c\uff0c\u4ee5p3\u4e3a\u4f8b\uff0cp4\u4e5f\u4e00\u6837<\/p>\n<pre><code class=\"language-go\">(*p3).name = &quot;egon&quot;\n(*p3).age = 18\n(*p3).sex = &quot;male&quot;\n\n\/\/ \u6ce8\u610f\uff01\uff01\uff01\n\u7c7b\u4f3c(*p3).name = &quot;egon&quot;\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u7b80\u5199\u6210p3.name = &quot;egon&quot;\uff0c\u8fd9\u662fGo\u8bed\u8a00\u5e2e\u6211\u4eec\u5b9e\u73b0\u7684\u8bed\u6cd5\u7cd6\u3002\n\nfmt.Printf(&quot;%T\\n&quot;,p3)  \/\/ *main.Person\nfmt.Println(p3.name,p3.age)  \/\/ egon 18<\/code><\/pre>\n<p>\u7ed3\u6784\u4f53\u6307\u9488\u4f1a\u964d\u4f4e\u4f20\u53c2\u7684\u5f00\u9500<\/p>\n<pre><code class=\"language-go\">package main\n\nimport &quot;fmt&quot;\n\ntype Person struct {\n    name     string\n    age      int\n    sex      string\n    city     string\n    hobbbies []string\n    sanwei   map[string]float64\n}\nfunc main() {\n    p3:=new(Person)\n    fmt.Println(p3 == nil)  \/\/ false\n\n    (*p3).name = &quot;egon&quot;\n    (*p3).age = 18\n    (*p3).sex = &quot;male&quot;\n\n    tell(p3)\n    fmt.Println(p3.name)  \/\/ EGON\n}\n\nfunc tell(p *Person){\n    fmt.Printf(&quot;%v:%v:%v\\n&quot;,p.name,p.age,p.sex)\n    p.name=&quot;EGON&quot;\n}<\/code><\/pre>\n<p>ps\uff1a\u5185\u5efa\u51fd\u6570make(T, args)\u4e0enew(T)<\/p>\n<pre><code class=\"language-go\">\/\/1\u3001\u76f8\u540c\u70b9\uff1a\n\u90fd\u662f\u7528\u6765\u4e3a\u67d0\u4e00\u7c7b\u578b\u5f00\u8f9f\u5185\u5b58\u7a7a\u95f4\uff0c\u5e76\u7528\u96f6\u503c\u586b\u5145\u5230\u5185\u5b58\u7a7a\u95f4\u4e2d\n\n\/\/2\u3001\u4e0d\u540c\u70b9\nmake\u901a\u5e38\u53ea\u7528\u4e8eslice\u3001map\u548cchannel\u5f00\u8f9f\u5185\u5b58\u7a7a\u95f4\uff0c\u5e76\u4e14\u7528\u96f6\u503c\u586b\u5145\uff0c\u7136\u540e\u8fd4\u56de\u4e00\u4e2aT\u7c7b\u578b\u7684\u503c\uff0c\u800c\u4e0d\u662f\u6307\u9488*T\u3002\nnew(T)\u7528\u4e8e\u4e3a\u5404\u79cd\u7c7b\u578b\u5f00\u8f9f\u5185\u5b58\u7a7a\u95f4\uff0c\u5e76\u7528\u96f6\u503c\u586b\u5145\uff0c\u7136\u540e\u8fd4\u56de\u5176\u5730\u5740\uff0c\u5373\u4e00\u4e2a\u6307\u9488*T\n<\/code><\/pre>\n<h2>\u516d \u9762\u8bd5\u9898<\/h2>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"1946\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"1946\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"3e23b9a0fa\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"7755f0f36d\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>\u7ed3\u6784\u4f53struct \u4e00 \u7ed3\u6784\u4f53\u4ecb\u7ecd \u200b \u4ec0\u4e48\u662fstruct\uff1f \u200b struct\u662fgo\u8bed\u8a00\u4e3a\u6211\u4eec\u63d0\u4f9b\u7684\u53ef\u4ee5\u81ea\u5b9a\u4e49 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2531,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[260,261,263,262],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/1946"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1946"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/1946\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/2531"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}