如何在没有加载源文件的情况下使用php函数?

Kev*_*ion 2 php function

我想使用我的函数,例如DebugR(),但我不想使用require或include(with include_path)来加载包含源的函数文件.

我知道我可以使用自动加载,但这个动作在我的php配置中必须是通用的.我想我必须创建一个PHP扩展,但还有另一种方法吗?

Eri*_*ick 5

您可以使用PHP配置行.

文档说明了这一点:

auto_prepend_file字符串

Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require() function, so include_path is used.

The special value none disables auto-prepending.
Run Code Online (Sandbox Code Playgroud)