我想做的很简单,但要使它发挥作用,我遇到了一些问题。。。它基本上是html页面上的一个文本,根据不同html文件上的文本进行更改。
主html文件:
<html>
<body>
<label for="Order2" id="Order2"> </label>
<script>
var Order2 = returnedfromthephpfile;
document.getElementById('Order2').innerHTML = Order2;
</script>
</body>
</html>
这是我的php文件:
<?php
$src = fopen('C:''Order.html', 'r');
return $src;
fclose($src);
?>
另一个html文件:
<TABLE BORDER="0" cellpadding="0" CELLSPACING="0"><TR><TD WIDTH="360" HEIGHT="190" VALIGN="top">Hello</TD></TR></TABLE>
有人知道我该怎么做吗,或者是否有更简单的方法?
您希望使用file_get_contents将文件的内容获取为字符串。http://us2.php.net/file_get_contents
$src = file_get_contents("path_to_file.txt")