问题如题。
最近在学PHP,看到fprintf这里,尝试打印“\n”,怎么样都打不出来(其他内容正常)。请问下,这是什么原因啊?怎么在文件中打印出“\n”呢?谢谢~~附PHP代码:
$outputstring = $date."\t".$tireqty." tires \t".$oilqty." oil\t".$sparkqty." spark plugs\t\$".$totalamount."\t".$address."\n";
// open file for appending
@$fp = fopen("$DOCUMENT_ROOT/flyfy1_data/practice/orders.txt","a+t");
if(!fp)
{
echo "<p><strong>Your order could not be processed at this time.. Please try again later.</strong></p>";
}
echo $outputstring; fwrite($fp,$outputstring,strlen($outputstring)+10);
fprintf($fp,"\n");
最近在学PHP,看到fprintf这里,尝试打印“\n”,怎么样都打不出来(其他内容正常)。请问下,这是什么原因啊?怎么在文件中打印出“\n”呢?谢谢~~附PHP代码:
$outputstring = $date."\t".$tireqty." tires \t".$oilqty." oil\t".$sparkqty." spark plugs\t\$".$totalamount."\t".$address."\n";
// open file for appending
@$fp = fopen("$DOCUMENT_ROOT/flyfy1_data/practice/orders.txt","a+t");
if(!fp)
{
echo "<p><strong>Your order could not be processed at this time.. Please try again later.</strong></p>";
}
echo $outputstring; fwrite($fp,$outputstring,strlen($outputstring)+10);
fprintf($fp,"\n");
解决方案 »
- 哪位达人 帮帮忙 修改下现在的代码 备份mysql的 php代码 要求备份到本地
- php 操作数组问题
- 学习失去方向,请指教下, 不知道自己会什么,不知道自己该学什么,不知道自己该怎么去学,还不知道把自己学的用到哪里
- 毕业才开始接触程序,公司带我的师傅给了我出了一道关于排序的题,我写的东西总是没输出,麻烦各位进来帮我看一看。
- PHP中_toString的问题
- 请问怎么在php中把html当做xml来处理?
- Spreadsheet_Excel_Reader存数据库乱码问题
- 下载后的媒体文件,与原来文件不一样, 头部多了0D0A,致使文件打不开,怎么回事?
- Warning: undefined variable: file in c:\...\index.php on line 10
- php 5.5.13 开发环境问题
- POST为什么不能接受qn.php?txtName=txt&gg= {这里为什么是空的}
- php 基础问题
windows系统,文本文件的回车是\r\n,linux系统是\r或\r\n
a+t 为什么有个t?
"a+t" : t表示以文本方式打开
恩,谢谢啦~~加上“\r\n”,问题解决;
PS:用notepad++打开用“\n”换行的文件,可以显示换行;但用Windows自带的NotePad不可以。