如何在PHP中自动包含文件? [英] How to include a file automatically in PHP?
本文介绍了如何在PHP中自动包含文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个site.php文件(类似于Python),它会自动包含在每次调用中。命令行执行或HTTP请求。此文件包含几个重要的替换函数,需要对现有应用程序和新的应用程序可用。
I would like to have a "site.php" file (similar to Python) that is automatically included on every invocation, e.g. command-line execution or HTTP request. This file contains several important replacement functions which need to be available to both existing applications and new.
(即,我需要包括此文件,而不修改任何与应用程序相关的文件)
(I.e. I need to include this file without modifying any files related to the applications in use.)
这是否可能?如果是,如何?
Is this possible? And if so, how?
推荐答案
在php.ini中设置
In php.ini set
auto_prepend_file="/path/to/site.php"
这篇关于如何在PHP中自动包含文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文