是否可以获取“.htaccess”文件的绝对路径?
我用它来加载init.php
在每个文件中。
php_value auto_prepend_file /Applications/XAMPP/xamppfiles/htdocs/init.php
有没有办法让我不必写绝对路径?
像这样,如果init.php
与.htaccess
file:
php_value auto_prepend_file [ABSOLUTE_PATH_TO_HTACCESS]/init.php
如果可能的话,我该如何写,但仍然返回一个目录(因为init.php
在外面public_html
,其中.htaccess
is).
提前致谢。
假设对已接受答案的更新响应here https://stackoverflow.com/questions/9045445/auto-prepened-php-file-using-htaccess-relative-to-htaccess-file有效,并且您的相对目录结构如您所描述:
[docroot]
|
\- init.php
|
\- public_html
|
\- .htaccess
|
\- index.php
那么你应该能够上一级目录init.php
您希望通过包含指令来添加的文件
php_value auto_prepend_file ./../init.php
在您的 .htaccess 文件中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)