【问题标题】:How to include php file in .htaccess?如何在 .htaccess 中包含 php 文件?
【发布时间】:2013-09-11 11:57:05
【问题描述】:

如何使用 .htaccess 包含 php 文件?我用谷歌搜索,但找不到好的教程或代码。

这是一个 php 包含代码:

<?php require('footer.php'); ?>

【问题讨论】:

    标签: php html file .htaccess include


    【解决方案1】:

    此代码是在文件前添加

    php_value auto_prepend_file "/dir/path/utilities.php"
    

    此代码是将文件附加到页面底部

    php_value auto_append_file "/dir/path/templates/footer.php"
    

    我在http://samweby.blogspot.in/2013/07/prepend-and-append-htaccess-file.html 链接中找到了这个答案。

    【讨论】:

      【解决方案2】:

      你可以试试auto_append_file,如下

      php_value auto_append_file  "footer.php"
      

      这将产生在每个 PHP 脚本之后包含 footer.php 的效果,我认为这就是您想要的吗?还有auto_prepend_file,会在每次请求前包含指定的脚本。

      【讨论】:

        猜你喜欢
        • 2022-10-25
        • 2011-03-28
        • 2011-02-27
        • 1970-01-01
        • 2011-06-18
        • 2014-12-07
        • 1970-01-01
        • 1970-01-01
        • 2020-09-29
        相关资源
        最近更新 更多