我試圖從php創建一個新的php文件。在PHP中編寫PHP文件
我最終的PHP文件必須是這樣的:
<?
$text_1 = "Text";
$text_2 = "Banana";
?>
其實我的PHP生成它是:
$file = fopen("../lang/_____fr-CA.php", "w") or die("Unable to open file!");
<?
$datas .= '$text_1 = "Text"; \n ';
$datas .= '$text_2 = "Banana"; \n ';
$datas = nl2br("<? \n".$datas."\n ?>");
fwrite($file, $datas);
fclose($file);
?>
我的問題是生成的PHP是這樣的:
<? <br />
$text_1 = "Text"; \n$text_2 = "Banana"; \n<br />
?>
能否請您查看以下鏈接:[http://stackoverflow.com/questions/3066421/writing-a-new-line-to-file-in-php](http://stackoverflow.com/questions/3066421 /編寫一個新的文件在php中) –