迪巴拉 发表于 2022-1-12 13:12:37

插件钩子没有生效

<p class="p1" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 80, 50);"><span class="s1" style="color: rgb(127, 0, 85);">class </span>plugin_test<span class="s2" style="color: rgb(0, 0, 0);"> {</span></p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"></p><p class="p3" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(85, 127, 95);"><span class="s2" style="color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">      </span></span>/*</p><p class="p3" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(85, 127, 95);"><span class="Apple-tab-span" style="white-space: pre;">      </span> * 贴内用户信息标记,返回值为标记显示内容</p><p class="p3" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(85, 127, 95);"><span class="Apple-tab-span" style="white-space: pre;">      </span> * "界面 ? 界面设置 ? 帖内用户信息" 用户信息模板中的标记</p><p class="p3" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(85, 127, 95);"><span class="Apple-tab-span" style="white-space: pre;">      </span> * 文档: http://open.discuz.net/?ac=document&page=plugin_hook (搜索"profile_node")</p><p class="p3" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(85, 127, 95);"><span class="Apple-tab-span" style="white-space: pre;">      </span> */</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="s1" style="color: rgb(127, 0, 85);">function</span> profile_node(<span class="s3" style="text-decoration-line: underline;">$post</span>, <span class="s3" style="text-decoration-line: underline;">$start</span>, <span class="s3" style="text-decoration-line: underline;">$end</span>) {</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="s1" style="color: rgb(127, 0, 85);">return </span><span class="s3" style="text-decoration-line: underline;">$start</span>.<span class="s4" style="color: rgb(0, 0, 192);">'我是插件'</span>.<span class="s3" style="text-decoration-line: underline;">$end</span>;</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">      </span>}</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space: pre;">      </span></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span><span class="s5" style="color: rgb(34, 128, 76);">public </span><span class="s1" style="color: rgb(127, 0, 85);">function</span> global_test()</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span>{</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">      </span><span class="s1" style="color: rgb(127, 0, 85);">global </span>$_G;</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">      </span><span class="s1" style="color: rgb(127, 0, 85);">if</span>(isset(<span class="s1" style="color: rgb(127, 0, 85);">$_GET</span>[<span class="s4" style="color: rgb(0, 0, 192);">'mod'</span>], <span class="s1" style="color: rgb(127, 0, 85);">$_GET</span>[<span class="s4" style="color: rgb(0, 0, 192);">'ac'</span>]) && <span class="s1" style="color: rgb(127, 0, 85);">$_GET</span>[<span class="s4" style="color: rgb(0, 0, 192);">'mod'</span>] == <span class="s4" style="color: rgb(0, 0, 192);">'spacecp' </span>&& <span class="s1" style="color: rgb(127, 0, 85);">$_GET</span>[<span class="s4" style="color: rgb(0, 0, 192);">'ac'</span>] == <span class="s4" style="color: rgb(0, 0, 192);">'avatar'</span>){</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"><span class="Apple-converted-space">            </span></p><p class="p3" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(85, 127, 95);"><span class="s2" style="color: rgb(0, 0, 0);">         </span>// die('ok1');</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"><span class="Apple-converted-space">            </span></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">      </span>}</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"></p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span>}</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);">}</p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"></p><p class="p1" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 80, 50);"><span class="s1" style="color: rgb(127, 0, 85);">class </span>plugin_test_home<span class="s2" style="color: rgb(0, 0, 0);"> </span><span class="s1" style="color: rgb(127, 0, 85);">extends </span>plugin_test<span class="s2" style="color: rgb(0, 0, 0);">{</span></p><p class="p2" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span><span class="s1" style="color: rgb(127, 0, 85);">function</span> spacecp_testxx()</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span>{</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">      </span>die(<span class="s4" style="color: rgb(0, 0, 192);">'ok2'</span>);</p><p class="p5" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(127, 0, 85);"><span class="s2" style="color: rgb(0, 0, 0);">      </span>return false<span class="s2" style="color: rgb(0, 0, 0);">;</span></p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);"><span class="Apple-converted-space">    </span>}</p><p class="p4" style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 0, 0);">}</p>
根据教程https://open.dismall.com/?ac=document&page=plugin_hook
function CURMODULE_USERDEFINE()

当访问
/home.php?mod=spacecp&ac=avatar时,这个 spacecp_testxx() 为什么没有被调用(global_test能被正常调用)?

浅生 发表于 2022-1-12 13:13:01

class plugin_test {      /*         * 贴内用户信息标记,返回值为标记显示内容         * "界面 ? 界面设置 ? 帖内用户信息" 用户信息模板中的标记         * 文档: http://open.discuz.net/?ac=document&page=plugin_hook (搜索"profile_node")         */      function profile_node($post, $start, $end) {                return $start.'我是插件'.$end;      }            public function global_test()    {      global $_G;      if(isset($_GET['mod'], $_GET['ac']) && $_GET['mod'] == 'spacecp' && $_GET['ac'] == 'avatar'){                     // die('ok1');                  }    }}class plugin_test_home extends plugin_test{      function spacecp_testxx()    {      die('ok2');      return false;    }}

上面乱码里,没权限编辑,代码在这里
页: [1]
查看完整版本: 插件钩子没有生效

创宇盾启航版免费网站防御网站加速服务