我有这段代码。
function PHP_Include( $atts )
{
$atts = htmlspecialchars($atts);
ob_start();
extract(shortcode_atts( array(
'file' => 'default'
), $atts ));
include get_theme_root() . '/' . get_template() . '/app/' . $file;
$output = ob_get_contents();
ob_end_clean();
return $output;
}
有人告诉我ob_start会让我的代码更安全,但我不知道以哪种方式?基本上,这个函数将“保留在内存中”代码然后输出代码来执行它,对吗?
其次,当我添加$atts = htmlspecialchars($atts);
代码不起作用时,我有一个白页,在这里我再也不知道为什么。 $atts is appfile.php
。我使用此短代码[phpinclude file='appfile.php']
。