<分区>
对于 JAVA 开发,我需要写入带有“\r\t\n <>”等字符串的文件,因为我想从 Java 编写一个 PHP 文件。如果你看不懂这个例子:
BufferedWriter buffW = new BufferedWriter(fileW);
buffW.write("<?php\n\n\tclass MyClass {\n\tpublic function test()\n}\n}\n?>");
这是一段乱七八糟的代码,我想写一个像 PHP 一样干净的代码,但是在 Java 上找不到替代方法作为示例:
<?php
$mystring = <<<EOT
This is some PHP text.
It is completely free
I can use "double quotes"
and 'single quotes',
plus $variables too, which will
be properly converted to their values,
you can even type EOT, as long as it
is not alone on a line, like this:
EOT;
?>