原文:獲取當前的方法名字,運用線程類Thread

得到當前方法的名字StringmethodName Thread.currentThread .getStackTrace .getMethodName getStackTrace 返回一個表示該線程堆棧轉儲的堆棧跟蹤元素數組。如果該線程尚未啟動或已經終止,則該方法將返回一個零長度數組。如果返回的數組不是零長度的,則其第一個元素代表堆棧頂,它是該序列中最新的方法調用。最后一個元素代表堆棧底,是該 ...

2019-10-12 09:42 0 747 推薦指數:

查看詳情

java獲取當前名和方法名

Description Below I present you two different ways to get the current Class: Using Thread Using getClass() The simplest way to get ...

Mon Jan 08 19:10:00 CST 2018 0 18234
Java獲取當前名和方法名

獲取class名: this.getClass().getName(); 或者 Thread.currentThread().getStackTrace()[1].getClassName(); 獲取方法名: Thread.currentThread().getStackTrace ...

Thu Jan 02 21:53:00 CST 2020 0 6876
PHP獲取當前名、函數名、方法名

PHP獲取當前名、方法名 __CLASS__ 獲取當前名 __FUNCTION__ 當前函數名(confirm) __METHOD__ 當前方法名 (bankcard::confirm) __FUNCTION__ 函數名稱(PHP 4.3.0 新加)。自 PHP ...

Fri Jan 17 09:19:00 CST 2014 0 72614
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM