Trace where code is coming from (PHP)

前端 未结 5 1705
北恋
北恋 2021-02-04 21:07

I\'m going through a customer\'s server, running crazy proprietary forum software (vBulletin) and even worse SEO mods (vbseo). I cannot figure out where the php code for a page

5条回答
  •  长情又很酷
    2021-02-04 21:29

    To trace the origin of a specific function, you can do this:

    $reflFunc = new ReflectionFunction('function_name');
    print $reflFunc->getFileName() . ':' . $reflFunc->getStartLine();
    

    See How to find out where a function is defined?

    To trace the origin of a specific class, you can do this:

    $reflClass = new ReflectionClass('class_name');
    print $reflClass->getFileName() . ':' . $reflClass->getStartLine();
    

    To get a list of all the includes that went into making a page, you can do this:

    var_dump(get_included_files());
    

    To get a list of all the functions that are defined on a page, you can do this:

    var_dump(get_defined_functions());
    

    To get a list of all the user-defined functions on a page, you can do this:

    $defined_functions = get_defined_functions();
    var_dump($defined_functions["user"]);
    

提交回复
热议问题