这是我的html输出.php。
public class Resource {
public static int cliamer = fgfgfger;
public static int reporting = grgrging;
}
我想将其保存到mytext中.java php怎么可能
像这样:
$myData = "java code goes here";
$fp = fopen('dir/mytext.java', 'w');
fwrite($fp, $myData);
fclose($fp);
此处的主要故障点将是文件夹的权限。
// 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);