在我的服务器上加载任何网站之前,我想运行在"/var/www/html/file.PHP"上找到的PHP脚本。我有Nginx作为反向代理。我试着在apache:上做这件事
<Location "/">
Action pre-script /var/www/html/file.php
SetHandler pre-script
</Location>
但因为Nginx是反向代理,我需要在他身上做这件事。怎么做?非常感谢。
您可以使用核心php.ini-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.
来源:http://php.net/manual/en/ini.core.php#ini.auto-准备文件