自己公司的网站怎么编辑,搭建一个小程序需要什么,手机html5网站开发,专业的网站制作专业公司为了更好地显示用户提交表单#xff0c;本节将在上一节的基础上将读取的用户表单显示在html的table标签中#xff0c;这一节将用到和数组有关的知识。 本节代码将从外部文件#xff08;.txt文件#xff09;中读取信息于指定数组中#xff0c;然后对逐条订单进行处… 为了更好地显示用户提交表单本节将在上一节的基础上将读取的用户表单显示在html的table标签中这一节将用到和数组有关的知识。 本节代码将从外部文件.txt文件中读取信息于指定数组中然后对逐条订单进行处理最后将处理后数据显示于table表单之中。 表单读取文件——viewOrders2.php文件 html
headtitleWaynes Drink Shop - Customer Orders/title
/head
body
?php//Get the root of the Web Servers Document in a variable$DOCUMENT_ROOT $_SERVER[DOCUMENT_ROOT];
?
h1Waynes Drink Shop/h1
h2Customer Orders/h2
?php//load the files data into the array$orders file($DOCUMENT_ROOT/../orders/DrinkOrder.txt);//Handle the error in reading data from fileif(!$orders){echo pstrongCant fetch files data/strong/p;exit;}$orderNum count($orders); //Output data in the htmls table tagecho table border\1\tr bgcolor\#CCCCCC\.thOrder Date/th.thMilk/th.thCoke/th.thTea/th.thCoffee/th.thJuice/th.thTotal/th.thAddress/th/tr;for($i 0; $i $orderNum; $i){//Warning:You must use \t not \t !!!$line explode(\t, $orders[$i]); $line[1] intval($line[1]);$line[2] intval($line[2]);$line[3] intval($line[3]);$line[4] intval($line[4]);$line[5] intval($line[5]);//iterator the $lineforeach($line as $data){echo td. $data. /td;}echo /tr;}echo /table;
?
/body
/html 注意要注意单引号和双引号的区别单引号仅仅表示字符本身不代表其他任何特殊含义其中的\t并不会转义解释成水平制表而双引号定义的一些特殊字符如转义字符和变量会被解析如\t就表示水平制表符。 表单显示结果 修订于2016/3/3 By野马菌转载于:https://www.cnblogs.com/yemajun/p/5239154.html