1.
<?php
$abc = "chenshan";
exec("ls", $out);
$tmp_out = json_encode($out);
exec("echo $tmp_out > tmp2.txt");
file_put_contents(dirname(__FILE__) . "/tmp3.txt", $abc . "\n", FILE_APPEND)
?>
2.
<?php
$input = file_get_contents(dirname(__FILE__) . "/testinput.txt");
$input2 = str_replace("><", ">\n<", $input);
file_put_contents(dirname(__FILE__) . "/tmp3.txt", $input2 . "\n", FILE_APPEND);
?>