你不能.如果您不包含或要求它,PHP不知道有什么.您可以使用.htaccess或php.ini自动包含一个文件,该文件与包含require或include的文件相同.
例如.htaccess
php_value auto_prepend_file "/full/path/to/a/prepend-file.php"
Run Code Online (Sandbox Code Playgroud)
在php.ini中
auto_prepend_file = "/full/path/to/a/prepend-file.php"
Run Code Online (Sandbox Code Playgroud)