How strange, to add data to the Notepad, with the T split, the result of each tab key length is inconsistent? Inconsistent?

Source: Internet
Author: User
Tags echo date flock
Strange, to add data to Notepad, with \ t partition, the results into a notepad, the length of each tab key is inconsistent?

See figure


Reply to discussion (solution)

Wood, is anyone answering?

The source code is as follows, is two files, one commits the data, one processes the data.




















Order Results




Bob ' s Auto Parts


Order Results


echo "

Order precessed at ";
echo Date (' H:i,js F ');
echo "

";
?>

$totalqty = 0;
Print_r ($_post);
echo "
";

$tireqty = $_post[' Tireqty ');
$oilqty = $_post[' Oilqty ');
$sparkqty = $_post[' Sparkqty ');
$address = $_post[' address '];
$DOCUMENT _root = $_server[' document_root ');
$totalqty = $tireqty + $oilqty + $sparkqty;
$date = Date (' H:i,js F Y ');
echo "Item Ordered: $totalqty
";
if ($totalqty ==0) {
echo "You do not have order anything on the Bob ' s site!";
} else {
if ($tireqty >0) {
echo $tireqty. " Tireqty
";
}
if ($oilqty >0) {
echo $oilqty. " Oilqty
";
}
if ($sparkqty >0) {
echo $sparkqty. " Sparkqty
";
}
}

$totalamount = 0.00;

Define (' Tireprice ', 100);
Define (' Oliprice ', 10);
Define (' Sparkprice ', 4);
$totalamount = $tireqty *tireprice
+ $oilqty *oliprice
+ $sparkqty *sparkprice;
$totalamount = Number_format ($totalamount, 2, '. ', ');
echo "

TotalAmount is $ ". $totalamount."

";
$tax _rate = 0.1;
$totalamount = $totalamount * (1+ $tax _rate);
echo "total including tax:$". $totalamount. "
";

$putstrings = $date. " \ t ". $tireqty." Tires\t ". $oilqty." Oil\t ". $sparkqty." Spark plugs\t "." TotalAmount $ ". $totalamount." \ t "." Address ". $address." \ r \ n ";
Print_r ($DOCUMENT _root);
@ $fp = fopen ("$DOCUMENT _root/. /orders/order.txt ", ' ab ');
Flock ($FP, LOCK_EX);
if (! $fp) {
echo "

Your order is isn't processed at this time.
Please try again later.

";
Exit
}
Fwrite ($fp, $putstrings, strlen ($putstrings));
Flock ($FP, lock_un);
Fclose ($FP);
echo "Order written!";

?>

This is the question of Notepad, you can use the editor such as notepad++ to open the text file just fine.

This is related to how many spaces tab equals. Notepad seems to be 8.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.