Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.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 什么也没发生_Php_Wordpress_Dompdf - Fatal编程技术网

Php 什么也没发生

Php 什么也没发生,php,wordpress,dompdf,Php,Wordpress,Dompdf,我在将DOMPDF集成到Wordpress时遇到问题 以下是完成的步骤: 安装 进入主题IR/dompdf/ 创建了路径/dompdf/lib/php字体库/类,其中要创建php库 进口的 已导入“FontLib”文件夹内容 ()进入 /dompdf/lib/php字体库/classes 代码如下: require_once(echo get_template_directory_uri()."/dompdf/dompdf_config.inc.php"); $html = '&l

我在将DOMPDF集成到Wordpress时遇到问题

以下是完成的步骤:

  • 安装 进入主题IR/dompdf/
  • 创建了路径/dompdf/lib/php字体库/类,其中要创建php库 进口的
  • 已导入“FontLib”文件夹内容 ()进入 /dompdf/lib/php字体库/classes
  • 代码如下:

        require_once(echo get_template_directory_uri()."/dompdf/dompdf_config.inc.php");
    
    $html =
      '<html><body>'.
      '<p>Put your html here, or generate it with your favourite '.
      'templating system.</p>'.
      '</body></html>';
    
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream(echo get_template_directory_uri()."/dompdf/testpdf.pdf");
    
    require_once(echo-get_-template_-directory_-uri()“/dompdf/dompdf_-config.inc.php”);
    $html=
    ''.
    “将你的html放在这里,或者用你最喜欢的内容生成它”。
    “模板系统。

    ”。 ''; $dompdf=新的dompdf(); $dompdf->load_html($html); $dompdf->render(); $dompd->stream(echo get_template_directory_uri()。“/dompd/testpdf.pdf”);
    不输出任何内容,我也尝试了stream(“testpdf.pdf”);作为最后一行,但没有成功

    有什么想法吗?谢谢。

    试试这个

    include get_template_directory() . '/dompdf/dompdf_config.inc.php';
    
    $html =
      '<html><body>'.
      '<p>Put your html here, or generate it with your favourite '.
      'templating system.</p>'.
      '</body></html>';
    
    $dompdf = new DOMPDF();
    $dompdf->load_html( $html );
    $dompdf->render();
    file_put_contents( get_template_directory() . "/dompdf/testpdf.pdf");
    
    包含获取模板目录()/dompdf/dompdf_config.inc.php';
    $html=
    ''.
    “将你的html放在这里,或者用你最喜欢的内容生成它”。
    “模板系统。

    ”。 ''; $dompdf=新的dompdf(); $dompdf->load_html($html); $dompdf->render(); 文件内容(获取模板目录()“/dompdf/testpdf.pdf”);
    为什么函数调用中写入了
    echo
    ?把它拿走
    echo
    removed仍然不起作用。在函数中尝试使用绝对url也没有成功PDF 0.6.1使用php字体库0.3.x。您应该复制存储库中的目录结构(如果您试图节省空间,可以删除“字体”和“www”目录)。此外,
    stream()
    方法调用应该只包含文件名,例如
    $dompdf->stream(“testpdf.pdf”)