0

这是我的 html 输出。从 .php 文件

public class Resource {

    public static int cliamer = fgfgfger;
    public static int reporting = grgrging;

}

我想把它保存到 mytext.java 怎么可能用 php

4

2 回答 2

1

像这样的东西:

$myData = "java code goes here";
$fp = fopen('dir/mytext.java', 'w');
fwrite($fp, $myData);
fclose($fp);

这里的主要失败点将是文件夹的权限。

于 2013-09-10T09:19:58.937 回答
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);
于 2013-09-10T09:19:41.643 回答