php - 捕获用于呈现我的网页的 php 文件的代码
问题描述
我正在尝试确定在我的网站 Wordpress 和 Woocommerce 上的页面上使用了哪些 php 文件。我利用此代码在我可以检查的页面上的 html 注释中捕获关联的 php 文件名。这段代码似乎工作,但也许太好了。在我网站的一个非常基本的页面上,生成的评论列出了 1,827 个不同的 php 文件。它真的要经过那么多文件才能生成一个网页吗?这段代码有问题吗?或者有没有办法将输出文件名缩小到定义页面功能的主要文件名?
<?php echo '<!--'; // you can display this code or show it in an HTML comment
$files = get_included_files();
if ($display_only_theme_files === true) {
$theme_folder = get_template_directory();
foreach ($files as $key => $file) {
if (strstr($file, $theme_folder) === false) {
unset($files[$key]);
}
}
}
print_r($files);
echo '-->'; // you can display this code or show it in an HTML comment
?>
解决方案
推荐阅读
- r - 在 R 中如何选择特定的单元格值/元素,使用它们执行计算并以特定格式显示
- rest - Grails 3 REST 安全性获得双重身份验证
- postgresql - 更改查询需要很长时间
- sql - 如何修复 ORA-01008:并非所有变量都绑定在 asp.net 中
- c# - 使用 C#(尤其是循环时间码)检查 ogg 文件属性 - 可能吗?
- c# - Paypal TLS1.2 / Http1.1 升级 - PayPal 支付标准的 HTML 表单基础
- tslint - tslint 使用 --project 时不排除 tsconfig.json 中的文件
- loops - 如何优雅地将变量传递给命令
- java - 继承设计模式的不变性
- sql - SQL 多对多过滤器只针对特定的数据组合