[英]how put html+script inside the image.php file
我無法合並這些代碼
把這個HTML代碼
<div id="time"></div>
<script>
function Timer() {
var dt=new Date()
document.getElementById('time').innerHTML=dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds();
setTimeout("Timer()",1000);
}
Timer();
</script>
內部image.php
<?php
header("Content-type: image/png");
$str1= " $_SERVER[REMOTE_ADDR]";
$str2= "**place code html**";
$image= imagecreate(200,40);
$background = imagecolorallocate($image,255,255,255);
$color= imagecolorallocate($image,0,0,0);
imagefill($image,0,0,$background);
imagestring($image,10,5,5,$str1,$color);
imagestring($image,10,5,20,$str2,$color);
imagepng($image)
?>
預期輸出
使用include()
或require()
。 它可以在php中加載html文件
例如
index.html:
<div class="node">hello, world!</div>
include.php
<?php
include("index.php");
?>
導致include.php:
hello, world!
會工作的
<?php
header("Content-type: image/png");
$str1= " $_SERVER[REMOTE_ADDR]";
$str2= "**place code html**";
$image= imagecreate(200,40);
$background = imagecolorallocate($image,255,255,255);
$color= imagecolorallocate($image,0,0,0);
imagefill($image,0,0,$background);
imagestring($image,10,5,5,$str1,$color);
imagestring($image,10,5,20,$str2,$color);
imagepng($image)
include("image.html")
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.