我在所有 *.html
文件中都有自定义语法,需要在提供之前通过 filter.php
进行过滤。我假设这可以通过 .htaccess
完成。
请注意,我不想将 *.html
解析为 PHP。
最佳答案
在你的htaccess中,添加
RewriteRule (.*\.html) filter.php?htmlfile=$1
现在,在 filter.php 中,您可以
$html = file_get_contents($_GET['htmlfile']);
// and do whatever you need to do
// then
echo $html;
关于php - 过滤传出的 html 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15538944/