dongsi1954 2014-12-30 08:15
浏览 20
已采纳

如何在PHP中转储用户定义或系统编译的函数?

Is there any way to dump a user defined or system compiled function same as print_r or var_dump for variables in PHP?

for example:

dump('echo');

or

dump('my_function');
  • 写回答

1条回答 默认 最新

  • duana1021 2014-12-30 10:06
    关注

    Such a function would be powerful.

    Some tools outside of PHP will help: A debugger, like gdb; a refactoring tool, like resharper/MonoDev and some tracing tools, like strace/dtrace. You would also use some tools, which expose internals, like Derick's VLD or PVT, which can dump the opcodes to a readable format, from there, it's not totally impossible to (re)create the code from it.

    Especially, in regard to commercial PHP extensions and products, like Zend Core/Platform or Zend Server it would be a reverse engineering / disassembling technique, because you are asking for C/C++ extension code from inside PHP.

    You ain't gonna need this technique!

    The benefit of doing this is some frameworks such as Zend extend some function to PHP global functions such as zend_report_statistics and I want to see their structures in my debug pages because they compiled in dll files.

    There is no real benefit, except debugging, in seeing the interals of a little stats reporting function.

    And by the way, the first thing you would see, when doing a dump('echo'); is, that echo is a language construct and not a function.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度