How to include a file automatically in PHP?

2020-06-04 03:18发布

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?

2条回答
等我变得足够好
2楼-- · 2020-06-04 04:09

In php.ini set

auto_prepend_file="/path/to/site.php"
查看更多
Melony?
3楼-- · 2020-06-04 04:14

EDITED - Read the initial post a bit too hastily, apologize.

In php.ini, instead..

auto_prepend_file="/path/to/site.php"
查看更多
登录 后发表回答