ajax
unread,Oct 22, 2009, 9:56:49 AM10/22/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CPHPUG-中国PHP用户组
源代码如下:
<?php
$tireqty = 100;
$oilqty = 10;
$date = date('H:i, jS F');
@ $fp = fopen("$DOCUMENT_ROOT/../html/test/orders/orders.txt", 'ab');
if(!$fp){
echo "<p><strong>Your order could not processed!</strong></p>";
exit;
}
echo $tireqty.' tires<br />';
echo $oilqty.' bottles of oil<br />';
$outputstring = $date." ".$tireqty." tires ".$oilqty." oil\n";
fwrite($fp, $outputstring, strlen($outputstring));
fclose($fp);
?>
在我对页面刷新了4次后,order.txt按道理来说应该是如下显示的:
13:48, 22nd October 100 tires 10 oil
13:48, 22nd October 100 tires 10 oil
13:49, 22nd October 100 tires 10 oil
13:51, 22nd October 100 tires 10 oil
而事实上它们却没有正常换行,换行符“\n”变成了一块黑糊糊的东西,还望大家帮忙看下啊,谢谢。
PS:我是在XP下运行的。