{"id":28687,"date":"2024-11-25T15:15:28","date_gmt":"2024-11-25T07:15:28","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28687\/"},"modified":"2024-11-25T15:15:28","modified_gmt":"2024-11-25T07:15:28","slug":"phpcms%e6%80%8e%e4%b9%88%e5%88%a4%e6%96%ad%e7%94%a8%e6%88%b7%e6%98%af%e5%90%a6%e7%99%bb%e5%bd%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28687\/","title":{"rendered":"phpcms\u600e\u4e48\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/039\/5e198a424fadc917.jpg\" class=\"aligncenter\" title=\"phpcms\u600e\u4e48\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u63d2\u56fe\" alt=\"phpcms\u600e\u4e48\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u63d2\u56fe\" \/><\/p>\n<p>\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>\u9996\u5148\u8981\u83b7\u53d6userid<\/p>\n<pre>&lt;?php         $userid= param::get_cookie(&#039;_userid&#039;);\n?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u518d\u5224\u65ad\u662f\u5426\u4e3a\u7a7a<\/p>\n<pre>{if&nbsp;$userid}&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u3002\u3002\u3002\u8fd9\u91cc\u5199\u5df2\u7ecf\u767b\u5f55\u4e4b\u540e\u7684\u4ee3\u7801\u3002\u3002\u3002\n{else}\n{\/if}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>phpcms\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u5b9e\u73b0\u4ee3\u7801\u5728phpcms\/modules\/member\/\u7684index.php\u4e2d\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>&lt;?php  \ndefined(&#039;IN_PHPCMS&#039;) or exit(&#039;No permission resources.&#039;);\nclass MY_index extends index {\n    private $times_db;\n    public function __construct() {\n        parent::__construct();\n    }\n\tpublic function top_mini() {\n\t\t$_username = param::get_cookie(&#039;_username&#039;);\n\t\t$_userid = param::get_cookie(&#039;_userid&#039;);\n\t\t$siteid = isset($_GET[&#039;siteid&#039;]) ? intval($_GET[&#039;siteid&#039;]) : &#039;&#039;;\n\t\t$jsoncallback=isset($_GET[&#039;jsoncallback&#039;]) ? $_GET[&#039;jsoncallback&#039;] : &#039;&#039;;\n\t\t\/\/\u5b9a\u4e49\u7ad9\u70b9id\u5e38\u91cf\n\t\tif (!defined(&#039;SITEID&#039;)) {\n\t\t   define(&#039;SITEID&#039;, $siteid);\n\t\t}\n\t\tif($_username){\n\t\t\t$res[\"success\"]=1;\n\t\t\t$res[\"message\"]=&#039;  &#039;.L(&#039;hellow&#039;).&#039;&lt;a href=\"&#039;.APP_PATH.&#039;member-account_manage_avatar.html\" target=\"_blank\"&gt;;@@##@@;;&nbsp;'.get_nickname().'&nbsp;\u6b22\u8fce\u56de\u5bb6&nbsp;&lt;a&gt;;'.L('member_center').'&lt;\/a&gt;;&nbsp;|&nbsp;&lt;a&gt;;\u53d1\u5e03\u4fe1\u606f&lt;\/a&gt;;&nbsp;|&nbsp;&lt;a&gt;;'.L('logout').'&lt;\/a&gt;;';\n\t\t\t$res[\"message\"]&nbsp;=&nbsp;pc_base::load_config('system',&nbsp;'charset')&nbsp;==&nbsp;'gbk'&nbsp;?&nbsp;iconv('utf-8',&nbsp;'utf-8',&nbsp;$res[\"message\"])&nbsp;:&nbsp;$res[\"message\"];\n\t\t\t\/\/get_nickname();\/\/,\n\t\t\t\n\t\t\t}\n\t\telse{\n\t\t\t$res[\"success\"]=0;\n\t\t\t}\n\t\t\t\n\t\tif($jsoncallback){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\t\techo&nbsp;$jsoncallback&nbsp;.&nbsp;\"({\"items\":[\".json_encode($res).\"]})\";\n\t\t}else{\n\t\t\techo&nbsp;json_encode($res);\n\t\t}\n\t\t\/\/echo&nbsp;json_encode($res);\n\t}\n\n}\n?&amp;gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>PHP\u4e2d\u6587\u7f51\uff0c\u5927\u91cf\u7684\u514d\u8d39\uff0c\u6b22\u8fce\u5728\u7ebf\u5b66\u4e60\uff01<\/p>\n<p><img> <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u7684\u65b9\u6cd5\uff1a \u9996\u5148\u8981\u83b7\u53d6userid &lt;?php $userid= param::get_cookie(&#039;_userid&#039;); ?&gt; \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\u518d\u5224\u65ad\u662f\u5426\u4e3a\u7a7a {if&nbsp;$userid}&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u3002\u3002\u3002\u8fd9\u91cc\u5199\u5df2\u7ecf\u767b\u5f55\u4e4b\u540e\u7684\u4ee3\u7801\u3002\u3002\u3002 {else} {\/if} \u767b\u5f55\u540e\u590d\u5236 phpcms\u5224\u65ad\u7528\u6237\u662f\u5426\u767b\u5f55\u5b9e\u73b0\u4ee3\u7801\u5728phpcms\/modules\/member\/\u7684index.php\u4e2d\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b &lt;?php defined(&#039;IN_PHPCMS&#039;) or exit(&#039;No permission resources.&#039;); class MY_index extends index { private $times_db; public function __construct() { parent::__construct(); } public function top_mini() { $_username = param::get_cookie(&#039;_username&#039;); $_userid = param::get_cookie(&#039;_userid&#039;); $siteid = isset($_GET[&#039;siteid&#039;]) ? intval($_GET[&#039;siteid&#039;]) : &#039;&#039;; $jsoncallback=isset($_GET[&#039;jsoncallback&#039;]) ? $_GET[&#039;jsoncallback&#039;] : [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-28687","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28687","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=28687"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28687\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}