[php]代码库
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>外地青年上海购房意愿调查-调查结果</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body bgColor=#004994>
<!--StartFragment-->
<TABLE cellSpacing=0 cellPadding=0 width=570 align=center bgColor=#ffffff
border=0>
<TBODY>
<TR>
<TD align=middle bgColor=#ffb959 height=43><TABLE cellSpacing=0 cellPadding=0 width=570 border=0>
<TBODY>
<TR>
<TD width=145 height=27><TABLE cellSpacing=0 cellPadding=0 width=145 bgColor=#cc5f24 border=0>
<TBODY>
<TR>
<TD height=3></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD width=280 height=27><TABLE cellSpacing=3 cellPadding=0 width=280 bgColor=#cc5f24 border=0>
<TBODY>
<TR>
<TD class=w14 vAlign=bottom align=middle height=20><div align="center"><FONT style="FONT-SIZE: 12pt"
color=#ffffff><strong>投票结果</strong></FONT></div></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD width=145 height=27><TABLE cellSpacing=0 cellPadding=0 width=145 bgColor=#cc5f24 border=0>
<TBODY>
<TR>
<TD
height=3></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
<?php
//读取标题
$t = file_get_contents("./data/t.txt");
$t = explode("\n", $t);
//读取问题
$a = file_get_contents("./data/a.txt");
$a = explode("\n", $a);
//读取结果
$r = file_get_contents("./data/r.txt");
$r = explode("\n", $r);
for($i=0; $i<count($t); $i++){
$a1 = explode("|", $a[$i]);
$r1 = explode("|", $r[$i]);
?>
<TABLE cellSpacing=1 cellPadding=1 align=center width="570"
bgColor=#ffffff border=0>
<TR>
<TD align=middle bgColor=#ffffff colSpan=3>
<TABLE class=black12 cellSpacing=8 cellPadding=0 border=0>
<TR>
<TD vAlign=top><FONT style="FONT-SIZE: 12pt" color=#6B3301><? echo $t[$i]?></FONT></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD width="28%" bgColor=#FFE7B9 align="center" height="24"><P><FONT style="FONT-SIZE: 11pt" color=#000000>选项</FONT></P></TD>
<TD width="47%" bgColor=#FFE7B9 align="center"><FONT style="FONT-SIZE: 11pt" color=#000000>比例</FONT></TD>
<TD width="25%" bgColor=#FFE7B9 align="center"><FONT style="FONT-SIZE: 11pt" color=#000000>票数</FONT> </TD>
</TR>
<?
$r2 = 0;
for($j=0; $j<count($r1); $j++){
$r2 += $r1[$j];
}
for($k=0; $k<count($a1); $k++){
?>
<TR>
<TD width="28%" bgColor=#F5F5F5><FONT style="FONT-SIZE: 9pt" color=#2F2F2F><?echo " ".$a1[$k]?></FONT></TD>
<TD width="47%" bgColor=#F5F5F5>
<TABLE width="262" border=0 cellPadding=0 cellSpacing=0>
<tr><td width="76" align="center"><FONT style="FONT-SIZE: 9pt" color=#2F2F2F><? echo round($r1[$k]*100/$r2, 2)?>%</FONT></td>
<td width="186">
<table width="<? echo round($r1[$k]*100/$r2, 2)?>%" border="0" cellpadding="0" cellspacing="0" background="http://202.123.110.196/govvote/vote/admin/images/vote/3.gif">
<tr><td height="10"></td>
</tr></table>
</td>
</tr>
</table>
</TD>
<TD width="25%" bgColor=#F5F5F5><FONT style="FONT-SIZE: 9pt" color=#2F2F2F><?echo $r1[$k]?></FONT> </TD>
</TR>
<?
}
?>
<TR bgColor=#000000>
<TD colSpan=4 height=1></TD>
</TR>
</TABLE>
<?
}
?>
<TABLE cellSpacing=0 cellPadding=0 width=570 align=center bgColor=#ffffff
border=0>
<TBODY>
<TR>
<TD align=middle bgColor=#ffb959 height=43></TD>
</TR>
</TBODY>
</TABLE>
<!--EndFragment-->
</body>
</html>
[源代码打包下载]