时间:2021-07-01 10:21:17 帮助过:22人阅读
//create short variable name
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
?>
Bob's Auto Parts - Customer Orders
Bob's Auto Parts
Customer Orders
//Read in the entire file.
//Each order becomes an element in the array
$orders= file("$DOCUMENT_ROOT/../orders/orders.txt");
// count the number of orders in the array
$number_of_orders = count($orders);
if ($number_of_orders == 0) {
echo "No orders pending.
";
Please try again later.
}
echo "
Order Date | Tires | Oil | Spark Plugs | Total | Address |
---|---|---|---|---|---|
".$line[0]." | ".$line[1]." | ".$line[2]." | ".$line[3]." | ".$line[4]." | ".$line[5]." |
intval() 变量转成整数类型
$line[1] = intval($line[1]);
$line[2] = intval($line[2]);
$line[3] = intval($line[3]);
转化成整数类型的变量重新组合数组$line
你也可以这样,重新赋值给变量
$line_a = intval($line[1]);
$line_b = intval($line[2]);
$line_c = intval($line[3]);
那么你的模板显示,对应的需要变动。