我希望在我的项目运行任何页面时都能加载文件variables.php
(该文件仅包含变量),以便我可以从任何地方使用这些变量。
我创建了一个名为.user.ini
的文件(并将其放置在根文件夹中):
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
auto_prepend_file = /Volumes/www/project_name/admin/libs/variables.php
它不起作用。似乎 PHP 没有读取 .user.ini 文件。
默认情况下,php.ini 已正确配置:
user_ini.cache_ttl 300 300
user_ini.filename .user.ini .user.ini
我哪里做错了?