php file_put_contents 生成文件
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
<script type="text/javascript">
function send_local(){ var my_html=$("#test").html(); $.ajax({ type:"POST", url:"http://localhost/mycenter/test.php", data:{my_html:my_html}, success:function(){alert("send ok")} }); }
</script>
</head>
<body>
<div id="test">test data</div>
<div>
<button onclick="send_local();">传到本地php</button>
</div>
</body>
</html>
test.php 代码如下:
<?php $my_html=$_POST['my_html']; ("test.txt",$my_html); ?>
教程链接:http://www.phprm.com/code/file_put_contents-create.html
随意转载~但请保留教程地址★