星期一, 八月 18, 2008

查看 PHP extensions(*.so) 的 Function/Object 列表

平常我們使用的 PHP extensions 很多, 像 GD, cURL 等都是 extensions. 更多的 PHP Extension 可見 PECL :: The PHP Extension Community Library.

這些都是有文件的, 但是若遇到是別人寫, 沒有文件的該怎麼辦.. Q_Qa.. 要如何查看此 Extension 裡面有哪些 function/object 可以用呢?

這時後可以用 nm, 詳細解釋: nm - list symbols from object files

查看使用方式

假設現在是 Debian Linux, PHP5, 有安裝 php5-gd 和 php5-curl 的環境:

  1. cd /usr/lib/php5/20060613+lfs
  2. nm -D gd.so # 下述只截錄一小段, 完整的可自行執行看看就知道.
    00012dd0 T zif_gd_info
    00007a70 T zif_image2wbmp
    00011be0 T zif_imagealphablending
    0000ce60 T zif_imagearc
    0000bb70 T zif_imagechar
    0000bb30 T zif_imagecharup
    00006f10 T zif_imagecolorallocate
    000117a0 T zif_imagecolorallocatealpha
  3. nm -D curl.so
    00002a40 T zif_curl_close
    00003a60 T zif_curl_copy_handle
    00002990 T zif_curl_errno
    00002b40 T zif_curl_error
    00003660 T zif_curl_exec
    00002c20 T zif_curl_getinfo
    00003e30 T zif_curl_init
    00009a20 T zif_curl_multi_add_handle
    000091b0 T zif_curl_multi_close
    000095d0 T zif_curl_multi_exec
    000094f0 T zif_curl_multi_getcontent
    000092e0 T zif_curl_multi_info_read
    00009b80 T zif_curl_multi_init
    000098f0 T zif_curl_multi_remove_handle
    00009720 T zif_curl_multi_select
    00008f90 T zif_curl_setopt
    00008e20 T zif_curl_setopt_array
    00004cb0 T zif_curl_version

看 T 系列, 把 "zif_" 拿掉, 就是 function name 囉~ :)

若沒有文件的狀況下, 就希望 Function name 是易懂的名字吧~ XD

相關標籤
Add this page to del.icio.us Add this page to Yahoo Taiwan's bookmark Add this page to MyShare

發表迴響

標題

內容 (限制 1000 字)

暱稱

電子郵件

個人網頁


 authimage


PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~