这是我的html输出。来自.php文件
public class Resource {
public static int cliamer = fgfgfger;
public static int reporting = grgrging;
}
我想将此保存到mytext.java,如何使用php
答案 0 :(得分:1)
这样的事情:
$myData = "java code goes here";
$fp = fopen('dir/mytext.java', 'w');
fwrite($fp, $myData);
fclose($fp);
此处的主要失败点是文件夹的权限。
答案 1 :(得分:0)
// beginning of your script
ob_start();
// your script
// end of your script
$data = ob_get_contents();
ob_end_clean(); // or ob_end_flush(); if you also want to output something
file_put_contents(dirname(__FILE__).'/mytext.java', $data);