久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發(fā)帖
查看: 1930|回復(fù): 4

[求助] 插件鉤子沒(méi)有生效

1

主題

3

回帖

9

積分

初學(xué)乍練

貢獻(xiàn)
0 點(diǎn)
金幣
5 個(gè)
樓主
發(fā)表于 2022-1-12 12:28:01 | 只看樓主 |倒序?yàn)g覽 |閱讀模式
  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);">
  2. </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> * 貼內(nèi)用戶信息標(biāo)記,返回值為標(biāo)記顯示內(nèi)容</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> * "界面 ? 界面設(shè)置 ? 帖內(nèi)用戶信息" 用戶信息模板中的標(biāo)記</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);">
  3. </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);">
  4. </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);">
  5. </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);">
  6. </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);">
  7. </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>
復(fù)制代碼

根據(jù)教程https://open.dismall.com/?ac=document&page=plugin_hook
  1. function CURMODULE_USERDEFINE[_output]()
復(fù)制代碼


當(dāng)訪問(wèn)
/home.php?mod=spacecp&ac=avatar時(shí),這個(gè) spacecp_testxx() 為什么沒(méi)有被調(diào)用(global_test能被正常調(diào)用)?
我知道答案 回答被采納將會(huì)獲得1 貢獻(xiàn) 已有4人回答
回復(fù)

使用道具 舉報(bào)

1

主題

3

回帖

9

積分

初學(xué)乍練

貢獻(xiàn)
0 點(diǎn)
金幣
5 個(gè)
置頂 來(lái)自 5#
 樓主| 發(fā)表于 2022-1-13 09:42:01 | 只看Ta
科站網(wǎng) 發(fā)表于 2022-1-12 17:42
https://open.dismall.com/?ac=document&page=plugin_hook腳本嵌入點(diǎn)demo里寫的
  1. 函數(shù)名并不限于以上列表,您可以自定義,只要符合以下規(guī)則,函數(shù)就會(huì)在適當(dāng)?shù)牡胤奖徽{(diào)用。

  2. function CURMODULE_USERDEFINE[_output]()
復(fù)制代碼

是要用這種嵌入點(diǎn)
但是這里說(shuō)的是不全面的,如果CURSCRIPT是home
那么嵌入點(diǎn)函數(shù)的寫法應(yīng)該是
  1. function CURMODULE_AC_USERDEFINE[_output]() //AC為對(duì)應(yīng)請(qǐng)求URL的ac參數(shù)值
復(fù)制代碼
回復(fù)

使用道具 舉報(bào)

1

主題

3

回帖

9

積分

初學(xué)乍練

貢獻(xiàn)
0 點(diǎn)
金幣
5 個(gè)
沙發(fā)
 樓主| 發(fā)表于 2022-1-12 12:30:44 | 只看Ta
  1. class plugin_test {

  2.         /*
  3.          * 貼內(nèi)用戶信息標(biāo)記,返回值為標(biāo)記顯示內(nèi)容
  4.          * "界面 ? 界面設(shè)置 ? 帖內(nèi)用戶信息" 用戶信息模板中的標(biāo)記
  5.          * 文檔: http://open.discuz.net/?ac=document&page=plugin_hook (搜索"profile_node")
  6.          */
  7.         function profile_node($post, $start, $end) {
  8.                 return $start.'我是插件'.$end;
  9.         }
  10.        
  11.     public function global_test()
  12.     {
  13.         global $_G;

  14.         if(isset($_GET['mod'], $_GET['ac']) && $_GET['mod'] == 'spacecp' && $_GET['ac'] == 'avatar'){
  15.             
  16.            // die('ok1');
  17.             
  18.         }


  19.     }

  20. }

  21. class plugin_test_home extends plugin_test{
  22.    
  23.     function spacecp_testxx()
  24.     {
  25.         die('ok2');
  26.         return false;
  27.     }
  28. }
復(fù)制代碼


上面亂碼里,沒(méi)權(quán)限編輯,代碼在這里
回復(fù)

使用道具 舉報(bào)

1

主題

3

回帖

9

積分

初學(xué)乍練

貢獻(xiàn)
0 點(diǎn)
金幣
5 個(gè)
板凳
 樓主| 發(fā)表于 2022-1-12 16:14:10 | 只看Ta
呃,知道了,home腳本的腳本嵌入點(diǎn)與其他頁(yè)面不一樣,跟后面的ac參數(shù)也有關(guān)。。。。文檔沒(méi)有標(biāo)明,坑了。。。
回復(fù)

使用道具 舉報(bào)

40

主題

3198

回帖

5451

積分

應(yīng)用開(kāi)發(fā)者

Discuz! 運(yùn)維

貢獻(xiàn)
215 點(diǎn)
金幣
685 個(gè)
QQ
地板
發(fā)表于 2022-1-12 17:42:15 | 只看Ta
https://open.dismall.com/?ac=document&page=plugin_hook腳本嵌入點(diǎn)demo里寫的
  1. //腳本嵌入點(diǎn)類
  2. class plugin_identifier_CURSCRIPT extends plugin_identifier {

  3.         function HookId_1() {
  4.                 ......
  5.                 return ...;
  6.         }

  7.         function HookId_2() {
  8.                 ......
  9.                 return ...;
  10.         }

  11.         ......

  12. }
復(fù)制代碼
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

  • 關(guān)注公眾號(hào)
  • 有償服務(wù)微信
  • 有償服務(wù)QQ

手機(jī)版|小黑屋|Discuz! 官方交流社區(qū) ( 皖I(lǐng)CP備16010102號(hào) |皖公網(wǎng)安備34010302002376號(hào) )|網(wǎng)站地圖|star

GMT+8, 2025-9-19 02:43 , Processed in 0.074280 second(s), 32 queries .

Powered by Discuz! W1.0 Licensed

Copyright © 2001-2025 Discuz! Team.

關(guān)燈 在本版發(fā)帖
有償服務(wù)QQ
有償服務(wù)微信
返回頂部
快速回復(fù) 返回頂部 返回列表