Function list of php file

前端 未结 12 1291
南方客
南方客 2020-11-28 14:40

How to get list of functions that are declared in a php file

12条回答
  •  孤城傲影
    2020-11-28 15:18

    You can use the get_defined_functions() function to get all defined function in your current script.

    See: http://www.php.net/manual/en/function.get-defined-functions.php

    If you want to get the functions defined in another file, you can try using http://www.php.net/token_get_all like this:

    $arr = token_get_all(file_get_contents('anotherfile.php'));
    

    Then you can loop through to find function tokens with the symbols defined. The list of tokens can be found http://www.php.net/manual/en/tokens.php

提交回复
热议问题