1
我需要编写一个函数,它定义了一个带有html标记的变量,现在在这个html标记中,我需要包含一个必须通过钩子传递给我的浏览器的php代码片段。在我的span标签中,我需要php代码片段才能正确输出。如何写入一个PHP函数,该函数定义了一个包含html和php的变量?
的PHP代码片段是这样的
<?php gravity_form(1, true, true, false, '', true); ?>
我的作用是低于通知PHP代码片段是如何被格式化,我需要找出如何正确格式化。
function html_fxcntab_hidden_gform() {
$html_fxcntab_hidden_gform_div = "<span style= \"display:none\";> <?php gravity_form(1, true, true, false, '', true); ?> </span>";
echo $html_fxcntab_hidden_gform_div;
}
add_action('wp_footer', 'html_fxcntab_hidden_gform');
谢谢,
迈克尔Sablatura
使用级联` '的'。 myFunction(1,true,false)。 '';` – Pablo 2011-02-08 04:15:21
如果`gravity_form`显示它的输出而不是返回它,它可能不会。他不得不使用输出缓冲; @伊格纳西奥的答案更简单。 – 2011-02-08 04:18:07