PHP中写HTML

html-css09

PHP中写HTML,第1张

原:echo '<script>location.href="moban.php?id='.$arr['id'].'"</script>'

你还不懂单引号余双引号的区别,单引号内是不可以读取变量值的,双引号可以。

正确代码:

echo "<script>location.href='moban.php?$arr[id]'</script>"

不懂得可以追问

PHP写入HTML文件可以使用file_put_contents,例如:

file_put_contents('a.html', "<html>

<body>hello</body>

</html>")

PHP访问HTML文件可以使用readfile、file等,例如:

readfile('a.html')