对于JAVA开发,我需要用“\ r \ t \ n \ 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;
?>