使用 php 创建动态 html 页面

Create dynamic html page with php

我需要使用 PHP 创建新的 html 页面。我需要的是获得一个新的 html 页面,其中包含 canvas。

此时我从另一个页面用 html2canvas 捕获 canvas。

我需要这个 canvas 成为新 html 页面的背景,或者只是一张 100%100% 高的图片。

我对 PHP 的看法是这样的,但我需要在飞行中捕捉图片或只是 canvas,然后制作如下内容:

<?php

    $file = file_get_contents("example.html");
    file_put_contents("example.html", $file);
?>

我该怎么做?谢谢。

据我了解,您正在尝试截取页面的屏幕截图,然后将其用作 PHP 中另一个新创建页面的背景。

看看这个截图:Website screenshots using PHP

截取屏幕截图后,只需使用诸如

之类的东西
$newpage = 'example.html';
$contents = file_get_contents($newpage);
$contents = "<html><style>background-image: '<?php echo //Your Saved Screenshot ?>'</style></html>";
file_put_contents($newpage, $contents);