该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
$vote = $_REQUEST['vote'];
print_r($_REQUEST);
//get content of textfile
$filename = "poll_result.txt";
$content = file($filename);
//put content in array
$array = explode("||", $content[0]);
$yes = $array[0];
$no = $array[1];
if ($vote == 0)
{
$yes = $yes + 1;
}
if ($vote == 1)
{
$no = $no + 1;
}
//insert votes to txt file
$insertvote = $yes."||".$no;
$fp = fopen($filename,"w");
fputs($fp,$insertvote);
fclose($fp);
?>
Result:
Yes: | width='<?php echo(100*round($yes/($no+$yes),2)); ?>' height='20'> <?php echo(100*round($yes/($no+$yes),2)); ?>% |
No: | width='<?php echo(100*round($no/($no+$yes),2)); ?>' height='20'> <?php echo(100*round($no/($no+$yes),2)); ?>% |
------------------------
responseText直接就是上面的html代码?
以前一直是用echo ‘写上html代码’;
为甚么上面不用就可以得到,与不在<?php ?>有关?