Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php echo在变量内部不工作_Php_Wordpress_Echo_Dompdf - Fatal编程技术网

Php echo在变量内部不工作

Php echo在变量内部不工作,php,wordpress,echo,dompdf,Php,Wordpress,Echo,Dompdf,我目前在使用PHP时遇到了一个奇怪的问题。我正在使用dompdf,因此将输出HTML分配给$output变量,如下所示: function ppt_pdf_output() { // post-ID of referring page needed $post = get_post($_POST['postid']); $category = get_the_category($_POST['postid']); $test = 'Test!'; $output

我目前在使用PHP时遇到了一个奇怪的问题。我正在使用dompdf,因此将输出HTML分配给$output变量,如下所示:

function ppt_pdf_output() {

// post-ID of referring page needed
$post       = get_post($_POST['postid']);
$category   = get_the_category($_POST['postid']);
$test       = 'Test!';

$output = '<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>'.$post->post_title.'</title>
<style>
@page {
    margin: 200px 50px 80px 50px;
}

/* more styles */
</style>
</head>
<body>Some content and HTML';
$output .='<table id="contact">Some more HTML and text'. echo $test .'</h1>
<div id="content">' .
    apply_filters('the_content',$post->post_content) . '</div>';
$output .= '</body></html>';

return $output;
}
函数ppt\u pdf\u输出(){
//需要引用页面的post ID
$post=get_post($_post['postid']);
$category=获取_类别($_POST['postid']);
$test='test!';
$output=
“.$post->post_title”
@页面{
保证金:200px 50px 80px 50px;
}
/*更多样式*/
一些内容和HTML';
$output.='Some more HTML and text'.echo$test'
' .
应用_过滤器('the_content',$post->post_content)。“”;
$output.='';
返回$output;
}
我没有得到:Wordpress变量在生成的PDF中显示得很好,但只要我想回显一个自定义变量(如本例中的$test),我就会得到一个空白页面(不是空白PDF,但我甚至无法生成它)

我认为这不是一个与dompdf相关的问题,而是一个与PHP相关的问题——但我是一个新手,不知道自己做错了什么,所以非常感谢您的帮助

亲切的问候

奥利

如果你说的是这一行

$output .='<table id="contact">Some more HTML and text'. echo $test .'</h1>
<div id="content">' .
$output.='Some more HTML and text'。echo$test。”
' .
您不需要执行echo,您可以将其连接为

$output .='<table id="contact">Some more HTML and text'. $test .'</h1>
<div id="content">' . 
$output.='Some more HTML and text'$测试。”
' . 

如果您正在谈论这一行

$output .='<table id="contact">Some more HTML and text'. echo $test .'</h1>
<div id="content">' .
$output.='Some more HTML and text'。echo$test。”
' .
您不需要执行echo,您可以将其连接为

$output .='<table id="contact">Some more HTML and text'. $test .'</h1>
<div id="content">' . 
$output.='Some more HTML and text'$测试。”
' . 

如果您正在谈论这一行

$output .='<table id="contact">Some more HTML and text'. echo $test .'</h1>
<div id="content">' .
$output.='Some more HTML and text'。echo$test。”
' .
您不需要执行echo,您可以将其连接为

$output .='<table id="contact">Some more HTML and text'. $test .'</h1>
<div id="content">' . 
$output.='Some more HTML and text'$测试。”
' . 

如果您正在谈论这一行

$output .='<table id="contact">Some more HTML and text'. echo $test .'</h1>
<div id="content">' .
$output.='Some more HTML and text'。echo$test。”
' .
您不需要执行echo,您可以将其连接为

$output .='<table id="contact">Some more HTML and text'. $test .'</h1>
<div id="content">' . 
$output.='Some more HTML and text'$测试。”
' . 
“您可以连接”可能不够强大,因为PHP抛出错误并停止执行其他操作(这是他看到的行为)。“您可以连接”可能不够强大,因为PHP抛出错误并停止执行其他操作(这是他看到的行为)。“您可以连接”可能还不够强大,因为PHP抛出一个错误并停止执行(这是他看到的行为)。“你可以连接”可能还不够强大,因为PHP抛出一个错误并停止执行(这是他看到的行为)。