首页 > PHP > PHP获取函数的所在模块

PHP获取函数的所在模块

查看PHP函数的源代码时非常有用

#!/usr/bin/php
<?php
if (empty($argv[1])) exit("Must be defined in PHP function\n");
$function_name = $argv[1];
$extensions = get_loaded_extensions();
 
foreach ($extensions as $m)
{
	$func = get_extension_funcs($m);
	if( ! is_array($func)) continue;
	if (in_array($name, $func))
	{
		printf("%s was defined in Module: %s\n", $name, $m);
		exit;
	}
}
echo "This function is not found.\n";
 
/* End of file get_function.php */

用法:./get_function.php function_name

分类: PHP 标签: ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.