{"id":49358,"date":"2024-12-02T14:23:09","date_gmt":"2024-12-02T06:23:09","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49358\/"},"modified":"2024-12-02T14:23:09","modified_gmt":"2024-12-02T06:23:09","slug":"thinkphp%e4%b8%ad%e5%a6%82%e4%bd%95%e8%bf%9b%e8%a1%8c%e8%a1%a8%e5%85%b3%e8%81%94%e6%9f%a5%e8%af%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49358\/","title":{"rendered":"ThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>ThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f<\/h1>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u7262\u56fa\u624e\u5b9e\u7684\u57fa\u7840\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u7c73\u4e91\u5c31\u6765\u5e26\u5927\u5bb6\u4e00\u70b9\u70b9\u7684\u638c\u63e1\u57fa\u7840\u77e5\u8bc6\u70b9\u3002\u4eca\u5929\u672c\u7bc7\u6587\u7ae0\u5e26\u5927\u5bb6\u4e86\u89e3\u300aThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f\u300b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u5feb\u70b9\u6536\u85cf\u8d77\u6765\u5427\uff0c\u5426\u5219\u9700\u8981\u65f6\u5c31\u627e\u4e0d\u5230\u4e86\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241130\/1732948598674ab2769bdc6.jpg\" class=\"aligncenter\" title=\"ThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f\u63d2\u56fe\" alt=\"ThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f\u63d2\u56fe\" \/><\/p>\n<p>\u5982\u4f55\u4f7f\u7528thinkphp\u8fdb\u884c\u8054\u5408\u67e5\u8be2\uff1f<\/p>\n<p>\u5728thinkphp\u6846\u67b6\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u8fdb\u884c\u8054\u5408\u67e5\u8be2\uff1a<\/p>\n<pre>$userid = session('user.id');\n$user = M('cuser');\n$data = $user-&gt;join('INNER JOIN project ON cuser.projectno= project.id')-&gt;where(array('cuser.id' =&gt; $userid))-&gt;select();\n$this-&gt;assign('title', $datas[0][name] . '\u7269\u4e1a\u7cfb\u7edf');<\/pre>\n<p>\u901a\u8fc7\u4e0a\u8ff0\u4ee3\u7801\uff0c\u53ef\u4ee5\u5b9e\u73b0\u8054\u5408\u4e24\u4e2a\u8868\uff08cuser \u548c project\uff09\u8fdb\u884c\u67e5\u8be2\uff0c\u5e76\u83b7\u53d6\u6ee1\u8db3\u6761\u4ef6\u7684\u7b2c\u4e00\u6761\u8bb0\u5f55\u3002\u5176\u4e2d\u7684 inner join \u8868\u793a\u5185\u8fde\u63a5\uff0c\u786e\u4fdd\u53ea\u8fd4\u56de\u540c\u65f6\u5b58\u5728\u4e8e\u4e24\u4e2a\u8868\u4e2d\u7684\u8bb0\u5f55\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f \u5bf9\u4e8e\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u7262\u56fa\u624e\u5b9e\u7684\u57fa\u7840\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u7c73\u4e91\u5c31\u6765\u5e26\u5927\u5bb6\u4e00\u70b9\u70b9\u7684\u638c\u63e1\u57fa\u7840\u77e5\u8bc6\u70b9\u3002\u4eca\u5929\u672c\u7bc7\u6587\u7ae0\u5e26\u5927\u5bb6\u4e86\u89e3\u300aThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f\u300b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u5feb\u70b9\u6536\u85cf\u8d77\u6765\u5427\uff0c\u5426\u5219\u9700\u8981\u65f6\u5c31\u627e\u4e0d\u5230\u4e86\uff01 \u5982\u4f55\u4f7f\u7528thinkphp\u8fdb\u884c\u8054\u5408\u67e5\u8be2\uff1f \u5728thinkphp\u6846\u67b6\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u8fdb\u884c\u8054\u5408\u67e5\u8be2\uff1a $userid = session(&#8216;user.id&#8217;); $user = M(&#8216;cuser&#8217;); $data = $user-&gt;join(&#8216;INNER JOIN project ON cuser.projectno= project.id&#8217;)-&gt;where(array(&#8216;cuser.id&#8217; =&gt; $userid))-&gt;select(); $this-&gt;assign(&#8216;title&#8217;, $datas[0][name] . &#8216;\u7269\u4e1a\u7cfb\u7edf&#8217;); \u901a\u8fc7\u4e0a\u8ff0\u4ee3\u7801\uff0c\u53ef\u4ee5\u5b9e\u73b0\u8054\u5408\u4e24\u4e2a\u8868\uff08cuser \u548c project\uff09\u8fdb\u884c\u67e5\u8be2\uff0c\u5e76\u83b7\u53d6\u6ee1\u8db3\u6761\u4ef6\u7684\u7b2c\u4e00\u6761\u8bb0\u5f55\u3002\u5176\u4e2d\u7684 inner join \u8868\u793a\u5185\u8fde\u63a5\uff0c\u786e\u4fdd\u53ea\u8fd4\u56de\u540c\u65f6\u5b58\u5728\u4e8e\u4e24\u4e2a\u8868\u4e2d\u7684\u8bb0\u5f55\u3002 \u4eca\u5929\u5173\u4e8e\u300aThinkPHP\u4e2d\u5982\u4f55\u8fdb\u884c\u8868\u5173\u8054\u67e5\u8be2\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/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-49358","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49358","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=49358"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49358\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}