·设为首页收藏本站📧邮箱修改🎁免费下载专区🔐设置/修改密码👽群雄群聊
返回列表 发布新帖

插件钩子没有生效

236 1
发表于 2022-1-12 13:12:37 | 显示全部楼层 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
  1. <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
  1. function CURMODULE_USERDEFINE[_output]()
复制代码

当访问
/home.php?mod=spacecp&ac=avatar时,这个 spacecp_testxx() 为什么没有被调用(global_test能被正常调用)?
我要说一句 收起回复

评论1

浅生Lv.8 发表于 2022-1-12 13:13:01 | 显示全部楼层
  1. 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;    }}
复制代码

上面乱码里,没权限编辑,代码在这里
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图

您的IP:3.144.77.71,125.74.1.77,GMT+8, 2024-5-4 08:53 , Processed in 0.214442 second(s), 78 queries , Gzip On, Redis On.

Based on Discuz! W1.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表