{"id":91342,"date":"2026-08-07T18:00:38","date_gmt":"2026-08-07T10:00:38","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/91342.html"},"modified":"2026-08-07T18:00:38","modified_gmt":"2026-08-07T10:00:38","slug":"%e4%bb%8e-php-%e5%88%b0-ai-golang%ef%bc%8c%e7%a8%8b%e5%ba%8f%e5%91%98%e8%87%aa%e6%95%91%e8%bd%ac%e5%9e%8b%e6%89%8b%e8%ae%b0%ef%bc%88%e4%ba%94%e5%8d%81%e4%ba%8c%ef%bc%89%ef%bc%9a%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/91342.html","title":{"rendered":"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978"},"content":{"rendered":"<p>\u8fd9\u662f\u4e00\u4e2a\u7cfb\u5217 Blog&#xff0c;\u4f5c\u8005\u5c06\u4ee5\u4e00\u4e2a PHP \u5168\u6808\u5de5\u7a0b\u5e08\u7684\u8eab\u4efd&#xff0c;\u5229\u7528 AI \u5de5\u5177&#xff08;claude code\u3001codex\u3001deepseek\u3001\u8c46\u5305\u7b49&#xff09;&#xff1a;\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60 golang \u8bed\u8a00&#xff0c;\u5e76\u6700\u7ec8\u5b8c\u6210 ai-go-admin&#xff08;github | gitee&#xff09;\u5f00\u6e90\u9879\u76ee\u7684\u5236\u4f5c&#xff0c;\u5168\u7a0b\u8bb0\u5f55\u5206\u4eab\u3002<\/p>\n<p>\u5728\u4e0a\u4e00\u671f&#xff0c;\u6211\u4eec\u8fdb\u884c\u4e86 \u201c\u7ba1\u7406\u5458\u548c\u89d2\u8272\u7ec4\u7684\u5173\u8054\u201d&#xff0c;\u672c\u671f\u5c06\u5b8c\u6210&#xff1a;\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6<\/p>\n<h2>\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6<\/h2>\n<p>\u4e4b\u524d\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86 RBAC \u6743\u9650\u6a21\u578b\u7684\u5f00\u53d1&#xff0c;\u63a5\u4e0b\u6765\u5efa\u7acb\u4e00\u4e2a \u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6&#xff0c;\u5bf9\u7ba1\u7406\u5458\u7684\u6bcf\u4e2a\u64cd\u4f5c\u8fdb\u884c\u68c0\u67e5\u3002<\/p>\n<p>\u6211\u5c06\u6b64\u4e2d\u95f4\u4ef6\u53d6\u540d\u4e3a AdminPermission&#xff08;\u6743\u9650&#xff09;&#xff0c;\u548c\u5df2\u6709\u7684 AdminAuth&#xff08;\u8ba4\u8bc1&#xff09;\u5bf9\u5e94\u3002<\/p>\n<p>\u548c BuildAdmin \u4e0d\u540c&#xff0c;\u672c\u7cfb\u7edf\u8ba4\u8bc1\u548c\u6743\u9650\u68c0\u67e5&#xff0c;\u90fd\u662f\u5728\u4e2d\u95f4\u4ef6\u5b8c\u6210&#xff0c;\u4e2d\u95f4\u4ef6\u7684\u4f7f\u7528\u65b9\u5f0f&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u5fc5\u987b\u767b\u5f55<\/span><br \/>\ngroup<span class=\"token punctuation\">.<\/span><span class=\"token function\">GET<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/init&#034;<\/span><span class=\"token punctuation\">,<\/span> middleware<span class=\"token punctuation\">.<\/span><span class=\"token function\">AdminAuth<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> h<span class=\"token punctuation\">.<\/span>Init<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u53ef\u9009\u767b\u5f55&#xff08;\u82e5\u4f20\u9012\u4e86\u6b63\u786e\u7684 token&#xff0c;\u4e2d\u95f4\u4ef6\u5c06\u5728\u8bf7\u6c42\u4e0a\u4e0b\u6587\u6ce8\u5165\u767b\u5f55\u7ba1\u7406\u5458\u4fe1\u606f&#xff0c;\u6ca1\u4f20\u9012 token \u4e5f\u4f1a\u653e\u884c&#xff09;<\/span><br \/>\ngroup<span class=\"token punctuation\">.<\/span><span class=\"token function\">POST<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/upload&#034;<\/span><span class=\"token punctuation\">,<\/span> middleware<span class=\"token punctuation\">.<\/span><span class=\"token function\">AdminAuthOptional<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> h<span class=\"token punctuation\">.<\/span>Upload<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5fc5\u987b\u767b\u5f55&#xff0c;\u540c\u65f6\u68c0\u67e5\u6743\u9650<\/span><br \/>\n<span class=\"token comment\">\/\/ \u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\u5c31\u662f\u672c\u6587\u7684\u76ee\u6807&#xff0c;\u5b83\u5fc5\u987b\u548c middleware.AdminAuth() \u4e2d\u95f4\u4ef6\u914d\u5957\u4f7f\u7528&#xff0c;\u6bd5\u7adf\u6ca1\u767b\u5f55\u548b\u9a8c\u6743\u5462<\/span><br \/>\ngroup<span class=\"token punctuation\">.<\/span><span class=\"token function\">POST<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/list&#034;<\/span><span class=\"token punctuation\">,<\/span> middleware<span class=\"token punctuation\">.<\/span><span class=\"token function\">AdminAuth<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> middleware<span class=\"token punctuation\">.<\/span><span class=\"token function\">AdminPermission<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> h<span class=\"token punctuation\">.<\/span>List<span class=\"token punctuation\">)<\/span><\/p>\n<p>AI \u505a\u51fa\u6765\u7684\u9996\u7248\u9a8c\u6743\u4e2d\u95f4\u4ef6&#xff0c;\u5728\u7ba1\u7406\u5458\u672a\u767b\u5f55\u65f6&#xff0c;\u76f4\u63a5\u653e\u884c\u5e76\u8868\u793a\u7531 AdminAuth \u62e6\u622a&#xff08;\u5b9e\u9645\u4e0a AdminPermission \u6bd4 AdminAuth \u540e\u6267\u884c&#xff0c;\u653e\u884c\u662f\u7edd\u5bf9\u9519\u8bef\u7684&#xff09;&#xff0c;\u672a\u5339\u914d\u5230\u6743\u9650\u89c4\u5219\u65f6&#xff0c;\u5c45\u7136\u4e5f\u4f1a\u653e\u884c\u7b49&#xff0c;\u76f8\u5f53\u4e8e AI \u628a\u653e\u884c\u5f53\u505a\u9ed8\u8ba4\u64cd\u4f5c&#xff0c;\u5982\u679c\u6ca1\u6709\u4eba\u5de5 review \u6216\u6d4b\u8bd5&#xff0c;\u8fd9\u5c06\u662f\u4e00\u4e2a\u5de8\u5927\u7684\u5b89\u5168\u6f0f\u6d1e\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u76f4\u63a5\u8ba9 AI \u7ed9\u89c4\u5212\u4e00\u4e0b&#xff1a;\u6211\u9700\u8981\u4e00\u4e2a admin_permission.go&#xff08;AdminPermission&#xff09;\u4e2d\u95f4\u4ef6&#xff0c;\u9700\u8981\u4f7f\u7528\u5b83\u5bf9\u7ba1\u7406\u5458\u7684\u6bcf\u6b21\u8bf7\u6c42\u8fdb\u884c\u9a8c\u6743&#xff0c;\u4f60\u89c9\u5f97\u5982\u4f55\u5199\u6bd4\u8f83\u5408\u9002&#xff1f;\u8981\u6c42\u548c\u4e0a\u4e0b\u6587\u5982\u4e0b&#xff1a;<\/p>\n<li>\u6743\u9650\u8282\u70b9\u79cd\u5b50\u6570\u636e\u5728 cmd\\\\migrate\\\\migrations\\\\000003_seed.up.sql \u91cc\u8fb9\u6709<\/li>\n<li>\u6743\u9650\u89c4\u5219\u8868\u5bf9\u5e94\u7684\u6a21\u578b\u5728 internal\\\\model\\\\admin.go \u4e2d\u7684 AdminRule \u6a21\u578b&#xff0c;\u4f60\u53ef\u4ee5\u5148\u8bfb\u53d6\u5b83\u4eec\u7684\u5b57\u6bb5\u7c7b\u578b\u5b9a\u4e49<\/li>\n<li>\u4ece gin \u8bf7\u6c42\u4e0a\u4e0b\u6587\u8bfb\u53d6\u5f53\u524d\u5339\u914d\u5230\u7684\u8def\u7531&#xff0c;\u4ece\u4e2d\u89e3\u6790\u51fa \u6743\u9650\u8282\u70b9\u7684 name&#xff0c;\u7136\u540e\u8c03\u7528 permission.Check \u9a8c\u6743<\/li>\n<li>\u5bf9\u4e8e List \u548c Get \u8bf7\u6c42&#xff0c;\u53ef\u4ee5\u68c0\u67e5 \u8def\u7531\u8def\u5f84\/read \u6743\u9650\u8282\u70b9<\/li>\n<p>AI \u5b8c\u6210\u4e86\u79cd\u5b50\u6570\u636e\u7684\u8bfb\u53d6&#xff0c;\u5e76\u5b8c\u6210\u4e86\u521d\u7248\u5b9e\u73b0&#xff0c;\u4eba\u5de5 review&#xff0c;\u5728\u91cc\u8fb9\u53d1\u73b0\u4e86\u4e00\u4e0b\u95ee\u9898&#xff1a;<\/p>\n<h3>\u9519\u8bef\u7684&#xff1a;\u8df3\u8fc7\u9a8c\u6743\u7684\u8def\u7531<\/h3>\n<p>AI \u5148\u5b9a\u4e49\u4e86\u4e00\u4e2a permissionSkipPaths map&#xff0c;\u91cc\u8fb9\u5b58\u50a8\u4e86\u9700\u8981\u8df3\u8fc7\u9a8c\u6743\u7684\u8def\u7531&#xff1a;<\/p>\n<p>PS&#xff1a;AI \u5c06 \/admin\/auth\/admin_log\/get\/:pk \u8fd9\u79cd\u8def\u5f84\u79f0\u4e3a \u8def\u7531\u6a21\u5f0f&#xff0c;\u56e0\u4e3a\u5b83\u4eec\u662f&#xff1a;\u5339\u914d\u6210\u529f\u7684\u5df2\u6ce8\u518c\u8def\u7531&#xff0c;\u5e26\u539f\u6837\u7684 \/get\/:pk \u5b57\u6837&#xff0c;\u800c\u4e0d\u662f\u7528\u6237\u8bf7\u6c42\u65f6\u7684 \/get\/1 \u8fd9\u79cd<\/p>\n<p><span class=\"token comment\">\/\/ permissionSkipPaths AdminPermission \u8df3\u8fc7\u9a8c\u6743\u7684\u8def\u7531\u6a21\u5f0f<\/span><br \/>\n<span class=\"token keyword\">var<\/span> permissionSkipPaths <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">map<\/span><span class=\"token punctuation\">[<\/span><span class=\"token builtin\">string<\/span><span class=\"token punctuation\">]<\/span><span class=\"token keyword\">struct<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token string\">&#034;\/admin\/init&#034;<\/span><span class=\"token punctuation\">:<\/span>                   <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token string\">&#034;\/admin\/clear-cache&#034;<\/span><span class=\"token punctuation\">:<\/span>            <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token string\">&#034;\/admin\/logout&#034;<\/span><span class=\"token punctuation\">:<\/span>                 <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token string\">&#034;\/admin\/auth\/admin_log\/list&#034;<\/span><span class=\"token punctuation\">:<\/span>    <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token string\">&#034;\/admin\/auth\/admin_log\/get\/:pk&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7136\u540e\u5728\u9a8c\u6743\u4e2d\u95f4\u4ef6\u91cc\u8fb9\u8fdb\u884c\u8df3\u8fc7&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u8df3\u8fc7\u5217\u8868\u4e2d\u7684\u8def\u7531\u4e0d\u9a8c\u6743<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token boolean\">_<\/span><span class=\"token punctuation\">,<\/span> skip <span class=\"token operator\">:&#061;<\/span> permissionSkipPaths<span class=\"token punctuation\">[<\/span>c<span class=\"token punctuation\">.<\/span><span class=\"token function\">FullPath<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> skip <span class=\"token punctuation\">{<\/span><br \/>\n    c<span class=\"token punctuation\">.<\/span><span class=\"token function\">Next<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u79cd\u8df3\u8fc7\u65b9\u5f0f\u662f\u9519\u8bef\u7684&#xff0c;\u56e0\u4e3a\u6839\u636e\u6211\u4eec\u7684\u8bbe\u8ba1\u76ee\u6807&#xff0c;\u4e0d\u9a8c\u6743\u7684&#xff0c;\u76f4\u63a5\u4e0d\u4f7f\u7528 AdminPermission \u4e2d\u95f4\u4ef6\u5c31\u884c\u4e86&#xff0c;\u5e94\u8be5\u76f4\u63a5\u5220\u9664\u8fd9\u4e9b\u591a\u4f59\u7684\u903b\u8f91\u3002<\/p>\n<h3>\u4e25\u91cd\u95ee\u9898&#xff1a;\u610f\u5916\u7684\u653e\u884c<\/h3>\n<p>\u5982\u4e0b\u4ee3\u7801\u63d0\u53d6\u7247\u6bb5&#xff0c;\u4e2d\u95f4\u4ef6\u5185\u6709\u591a\u5904\u653e\u884c&#xff1a;<\/p>\n<p>admin <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">GetAdmin<\/span><span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">if<\/span> admin <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token boolean\">nil<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u672a\u767b\u5f55&#xff0c;\u7531 AdminAuth \u62e6\u622a 401&#xff0c;\u653e\u884c<\/span><br \/>\n    c<span class=\"token punctuation\">.<\/span><span class=\"token function\">Next<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>action<span class=\"token punctuation\">,<\/span> nodeSuffix <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">extractAction<\/span><span class=\"token punctuation\">(<\/span>fullPath<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">if<\/span> nodeSuffix <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;&#034;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u65e0\u6cd5\u8bc6\u522b\u52a8\u4f5c&#xff0c;\u653e\u884c<\/span><br \/>\n    c<span class=\"token punctuation\">.<\/span><span class=\"token function\">Next<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u9996\u5148\u672a\u767b\u5f55\u7684\u76f4\u63a5\u653e\u884c\u5c31\u662f\u4e25\u91cd\u7684\u9519\u8bef&#xff0c;\u5e94\u8be5\u76f4\u63a5\u62e6\u622a&#xff0c;\u5e76\u63d0\u793a\u672a\u767b\u5f55\u3002<\/p>\n<p>\u5176\u6b21 AI \u5199\u4e86\u4e00\u4e2a\u4ece fullPath \u672b\u5c3e\u63d0\u53d6\u5f53\u524d\u52a8\u4f5c\u7684\u65b9\u6cd5&#xff0c;\u5982\u679c\u63d0\u53d6\u5931\u8d25&#xff0c;\u4e5f\u653e\u884c&#xff0c;\u8fd9\u4e0e\u6211\u4eec\u7684\u8bbe\u8ba1\u4e0d\u7b26&#xff0c;\u552f\u4e8c\u653e\u884c\u89c4\u5219\u5e94\u8be5\u662f\u8d85\u7ba1\u548c\u5b58\u5728\u5339\u914d\u7684\u8282\u70b9\u3002<\/p>\n<h3>\u6539\u9020\u6743\u9650\u89c4\u5219\u7ba1\u7406\u5668\u7684 Check \u65b9\u6cd5<\/h3>\n<p>\u6211\u4eec\u8bbe\u8ba1\u7684\u6743\u9650\u8282\u70b9&#xff0c;\u5e76\u4e0d\u4f1a\u533a\u5206 list \u548c get \u8bf7\u6c42&#xff0c;\u6211\u672c\u662f\u60f3\u7edf\u4e00\u68c0\u67e5 read \u6743\u9650\u8282\u70b9\u3002<\/p>\n<p>AI \u5199\u51fa\u6765\u7684\u7248\u672c\u4e2d\u89c4\u4e2d\u77e9&#xff0c;\u5c31\u662f\u5148\u68c0\u67e5 list \u8282\u70b9&#xff0c;\u6ca1\u6709\u5c31\u7ee7\u7eed\u68c0\u67e5 read \u8282\u70b9&#xff0c;\u4f46\u662f\u8fd9\u4f1a\u67e5\u5e93\u4e24\u6b21&#xff0c;\u6240\u4ee5\u6211\u4eec\u91cd\u65b0\u89c4\u5212\u4e00\u4e0b\u3002<\/p>\n<p>\u6211\u4eec\u4ece permission.Check \u65b9\u6cd5\u5165\u624b&#xff0c;\u8ba9\u5b83\u652f\u6301\u5728\u4e00\u6b21\u67e5\u8be2\u4e2d&#xff0c;\u9a8c\u8bc1\u4e24\u4e2a\u8282\u70b9\u5c31\u884c\u4e86&#xff0c;\u5982\u4e0b&#xff1a;<\/p>\n<li>\u4e2d\u95f4\u4ef6\u5185\u65e0\u9700\u8d85\u7ba1\u77ed\u8def&#xff0c;permission.Check \u91cc\u8fb9\u5df2\u7ecf\u6709\u4e86<\/li>\n<li>permission.Check \u7684 ruleName \u6539\u4e3a ruleNames []string&#xff0c;\u989d\u5916\u589e\u52a0\u4e00\u4e2a op \u53c2\u6570&#xff0c;\u503c\u662f OR \u6216 AND&#xff08;\u9ed8\u8ba4&#xff09;&#xff0c;\u7136\u540e\u5c06&#xff1a;name \u5b57\u6bb5\u7684\u6570\u636e\u5e93\u67e5\u8be2\u64cd\u4f5c\u7b26\u53f7\u6539\u4e3a IN&#xff0c;op&#061;OR \u53ea\u8981\u6709\u7ed3\u679c\u5c31\u8fd4\u56de true&#xff0c;op&#061;AND \u65f6\u9700\u8981\u5168\u90e8\u6709\u7ed3\u679c\u624d\u8fd4\u56de true<\/li>\n<li>\u68c0\u67e5\u8def\u5f84\u672b\u5c3e\u662f list \u7684\u8bf7\u6c42\u65f6&#xff0c;\u540c\u65f6\u5411 permission.Check \u4f20\u9012 read \u7684 Check path&#xff0c;list \u7684\u5728\u524d&#xff0c;op \u8bbe\u4e3a OR&#xff0c;\u5176\u4f59\u6743\u9650\u8282\u70b9\u68c0\u67e5\u5168\u90e8\u7528 AND<\/li>\n<p>\u5bf9 Check \u65b9\u6cd5\u7684\u6539\u9020\u603b\u4f53\u5f88\u7b80\u5355&#xff0c;\u4eba\u5de5 review \u53ea\u627e\u5230\u4e24\u4e2a\u7ec6\u8282\u95ee\u9898&#xff1a;<\/p>\n<p>\u4e00\u3001\u5e94\u8be5\u5bf9 op \u7edf\u4e00\u8f6c\u5c0f\u5199\u540e&#xff0c;\u518d\u8fdb\u884c\u68c0\u67e5<\/p>\n<p>\u4e8c\u3001\u64cd\u4f5c\u7b26\u53f7\u9650\u5b9a\u5728 or \u548c and \u4e4b\u95f4<\/p>\n<p><span class=\"token comment\">\/\/ \u539f\u6765\u7684<\/span><br \/>\n<span class=\"token keyword\">if<\/span> op <span class=\"token operator\">!&#061;<\/span> <span class=\"token string\">&#034;&#034;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    op <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;and&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6539\u4e3a<\/span><br \/>\n<span class=\"token keyword\">if<\/span> op <span class=\"token operator\">!&#061;<\/span> <span class=\"token string\">&#034;or&#034;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    op <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;and&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u4e2d\u95f4\u4ef6\u903b\u8f91\u91cd\u65b0\u6574\u7406<\/h3>\n<p>\u73b0\u5728\u53ef\u4ee5\u91cd\u65b0\u68b3\u7406\u6574\u4e2a\u4e2d\u95f4\u4ef6\u7684\u903b\u8f91&#xff0c;\u6838\u5fc3\u5176\u5b9e\u975e\u5e38\u7b80\u5355&#xff0c;\u88ab AI \u641e\u590d\u6742\u4e86&#xff0c;\u5c31\u4e00\u4ef6\u4e8b\u800c\u5df2&#xff1a;\u6839\u636e\u8def\u7531\u6a21\u5f0f\u6784\u5efa\u6743\u9650\u8282\u70b9\u7684 name&#xff0c;\u7136\u540e\u76f4\u63a5\u4f20\u9012\u7ed9 permission.Check \u5c31\u884c\u4e86\u3002<\/p>\n<p>\u5728 AI \u4e4b\u524d\u7684\u89c4\u5212\u4e2d&#xff0c;\u6211\u4eec\u5f97\u77e5&#xff0c;\u539f\u6765\u6211\u4eec\u53ef\u4ee5\u83b7\u53d6\u5230\u5f53\u524d\u8bf7\u6c42\u7684&#xff1a;\u8def\u7531\u6a21\u5f0f&#xff08;\u5339\u914d\u6210\u529f\u7684\u5df2\u6ce8\u518c\u8def\u7531&#xff0c;\u5e26\u539f\u6837\u7684 \/get\/:pk \u5b57\u6837&#xff0c;\u800c\u4e0d\u662f\u7528\u6237\u8bf7\u6c42\u65f6\u7684 \/get\/1 \u8fd9\u79cd&#xff09;\u3002<\/p>\n<p>\u5982\u679c\u662f\u7528\u6237\u8bf7\u6c42\u7684 URL&#xff0c;\u8981\u63d0\u53d6\u6743\u9650\u8282\u70b9\u786e\u5b9e\u6709\u70b9\u9ebb\u70e6&#xff0c;\u56e0\u4e3a\u53c2\u6570\u6570\u91cf\u662f\u4e0d\u56fa\u5b9a\u7684&#xff0c;\u4f46\u662f\u73b0\u5728\u4ece\u56fa\u5b9a\u7684 \u8def\u7531\u6a21\u5f0f \u63d0\u53d6\u8282\u70b9\u540d\u79f0&#xff0c;\u53ef\u5c31\u592a\u7b80\u5355\u4e86&#xff1a;<\/p>\n<p>\u793a\u4f8b\u8def\u7531\u6a21\u5f0f&#xff1a;\/admin\/auth\/admin-log\/get\/:pk<\/p>\n<li>\u53bb\u6389\u5f00\u5934\u7684 \/admin\/ \u5f97\u5230 auth\/admin-log\/get\/:pk<\/li>\n<li>\u4ee5 \/ \u5207\u5272\u4e3a [auth, admin-log, get, :pk]&#xff0c;\u4ece\u7b2c\u4e00\u4e2a\u542b\u6709 : \u7b26\u53f7\u7684\u5143\u7d20\u5f00\u59cb\u5168\u90e8\u4e22\u5f03&#xff0c;\u5269\u4e0b\u7684\u7528 \/ \u518d\u62fc\u56de string&#xff0c;\u5c31\u662f\u6743\u9650\u8282\u70b9\u7684 name \u4e86<\/li>\n<table>\n<tr>\u8def\u7531\u6a21\u5f0f\u6743\u9650\u8282\u70b9 name<\/tr>\n<tbody>\n<tr>\n<td>\/admin\/auth\/admin-log\/get\/:pk<\/td>\n<td>auth\/admin-log\/get<\/td>\n<\/tr>\n<tr>\n<td>\/admin\/auth\/test\/create\/:pk\/info<\/td>\n<td>auth\/test\/create<\/td>\n<\/tr>\n<tr>\n<td>\/admin\/auth\/test\/update<\/td>\n<td>auth\/test\/update<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8282\u70b9 name \u662f\u7ba1\u7406\u5458\u81ea\u5df1\u5728\u83dc\u5355\u89c4\u5219\u7ba1\u7406\u4e2d\u5b9a\u4e49\u7684&#xff0c;\u53ea\u8981\u9075\u5faa\u4ee5\u4e0a\u89c4\u5219&#xff0c;\u8282\u70b9\u81ea\u7136\u5c31\u80fd\u5339\u914d\u5230&#xff0c;\u5339\u914d\u4e0d\u5230\u4e5f\u6ca1\u5173\u7cfb&#xff0c;\u7a0b\u5e8f\u4e0d\u4f1a\u653e\u884c&#xff08;\u53c8\u60f3\u8d77\u4e4b\u524d AI \u8ba4\u4e3a\u53ef\u4ee5\u653e\u884c&#x1f602;&#xff0c;\u592a\u5751\u4e86&#xff09;&#xff0c;\u7ba1\u7406\u5458\u518d\u81ea\u884c\u4fee\u6539\u5c31\u884c\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u4e00\u4e2a\u7cfb\u5217 Blog&#xff0c;\u4f5c\u8005\u5c06\u4ee5\u4e00\u4e2a PHP \u5168\u6808\u5de5\u7a0b\u5e08\u7684\u8eab\u4efd&#xff0c;\u5229\u7528 AI \u5de5\u5177&#xff08;claude code\u3001codex\u3001deepseek\u3001\u8c46\u5305\u7b49&#xff09;&#xff1a;\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60 golang \u8bed\u8a00&#xff0c;\u5e76\u6700\u7ec8\u5b8c\u6210 ai-go-admin&#xff08;github | gitee&#xff09;\u5f00\u6e90\u9879\u76ee\u7684\u5236\u4f5c&#xff0c;\u5168\u7a0b\u8bb0\u5f55\u5206\u4eab\u3002<br \/>\n\u5728\u4e0a\u4e00\u671f&#xff0c;\u6211\u4eec\u8fdb\u884c\u4e86 \u201c\u7ba1\u7406\u5458\u548c\u89d2\u8272\u7ec4\u7684\u5173\u8054\u201d&amp;#xff0c<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10187,746,230,568,50,87],"topic":[],"class_list":["post-91342","post","type-post","status-publish","format-standard","hentry","category-server","tag-codingplan","tag-golang","tag-php","tag-typescript","tag-50","tag-87"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/91342.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u8fd9\u662f\u4e00\u4e2a\u7cfb\u5217 Blog&#xff0c;\u4f5c\u8005\u5c06\u4ee5\u4e00\u4e2a PHP \u5168\u6808\u5de5\u7a0b\u5e08\u7684\u8eab\u4efd&#xff0c;\u5229\u7528 AI \u5de5\u5177&#xff08;claude code\u3001codex\u3001deepseek\u3001\u8c46\u5305\u7b49&#xff09;&#xff1a;\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60 golang \u8bed\u8a00&#xff0c;\u5e76\u6700\u7ec8\u5b8c\u6210 ai-go-admin&#xff08;github | gitee&#xff09;\u5f00\u6e90\u9879\u76ee\u7684\u5236\u4f5c&#xff0c;\u5168\u7a0b\u8bb0\u5f55\u5206\u4eab\u3002 \u5728\u4e0a\u4e00\u671f&#xff0c;\u6211\u4eec\u8fdb\u884c\u4e86 \u201c\u7ba1\u7406\u5458\u548c\u89d2\u8272\u7ec4\u7684\u5173\u8054\u201d&amp;#xff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/91342.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-07T10:00:38+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91342.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/91342.html\",\"name\":\"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-07T10:00:38+00:00\",\"dateModified\":\"2026-08-07T10:00:38+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/91342.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/91342.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91342.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/91342.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u8fd9\u662f\u4e00\u4e2a\u7cfb\u5217 Blog&#xff0c;\u4f5c\u8005\u5c06\u4ee5\u4e00\u4e2a PHP \u5168\u6808\u5de5\u7a0b\u5e08\u7684\u8eab\u4efd&#xff0c;\u5229\u7528 AI \u5de5\u5177&#xff08;claude code\u3001codex\u3001deepseek\u3001\u8c46\u5305\u7b49&#xff09;&#xff1a;\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60 golang \u8bed\u8a00&#xff0c;\u5e76\u6700\u7ec8\u5b8c\u6210 ai-go-admin&#xff08;github | gitee&#xff09;\u5f00\u6e90\u9879\u76ee\u7684\u5236\u4f5c&#xff0c;\u5168\u7a0b\u8bb0\u5f55\u5206\u4eab\u3002 \u5728\u4e0a\u4e00\u671f&#xff0c;\u6211\u4eec\u8fdb\u884c\u4e86 \u201c\u7ba1\u7406\u5458\u548c\u89d2\u8272\u7ec4\u7684\u5173\u8054\u201d&amp;#xff0c","og_url":"https:\/\/www.wsisp.com\/helps\/91342.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-07T10:00:38+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/91342.html","url":"https:\/\/www.wsisp.com\/helps\/91342.html","name":"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-07T10:00:38+00:00","dateModified":"2026-08-07T10:00:38+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/91342.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/91342.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/91342.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4ece PHP \u5230 AI + Golang\uff0c\u7a0b\u5e8f\u5458\u81ea\u6551\u8f6c\u578b\u624b\u8bb0\uff08\u4e94\u5341\u4e8c\uff09\uff1a\u7ba1\u7406\u5458\u6743\u9650\u68c0\u67e5\u4e2d\u95f4\u4ef6\uff0cAI \u968f\u610f\u653e\u884c\u9884\u95ef\u5927\u7978"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=91342"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91342\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=91342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=91342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=91342"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=91342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}