日期:2014-05-17  浏览次数:20554 次

链接库(txt)与可以查询功能就这点分了。
PHP code
<form action="INDEX.php" method="post">
<select name="month">
<option value="1"<?php if(isset($_POST["month"]) && $_POST["month"] == "子时(23点-凌晨1点前)") echo 'selected="selected"';?>>子时(23点-凌晨1点前)</option>
<option value="2"<?php if(isset($_POST["month"]) && $_POST["month"] == "丑时(1点-凌晨3点前)")echo 'selected="selected"';?>>丑时(1点-凌晨3点前)</option>
<option value="3"<?php if(isset($_POST["month"]) && $_POST["month"] == "寅时(3点-凌晨5点前)") echo 'selected="selected"';?>>寅时(3点-凌晨5点前)</option>
<option value="4"<?php if(isset($_POST["month"]) && $_POST["month"] == "卯时(5点-上午7点前)") echo 'selected="selected"';?>>卯时(5点-上午7点前)</option>
<option value="5"<?php if(isset($_POST["month"]) && $_POST["month"] == "辰时(7点-上午9点前)") echo 'selected="selected"';?>>辰时(7点-上午9点前)</option>
<option value="6"<?php if(isset($_POST["month"]) && $_POST["month"] == "巳时(9点-上午11点前)") echo 'selected="selected"';?>>巳时(9点-上午11点前)</option>
<option value="7"<?php if(isset($_POST["month"]) && $_POST["month"] == "午时(11点-中午13点前)") echo 'selected="selected"';?>>午时(11点-中午13点前)</option>
<option value="8"<?php if(isset($_POST["month"]) && $_POST["month"] == "未时(13点-下午15点前)") echo 'selected="selected"';?>>未时(13点-下午15点前)</option>
<option value="9"<?php if(isset($_POST["month"]) && $_POST["month"] == "申时(15点-下午17点前)") echo 'selected="selected"';?>>申时(15点-下午17点前)</option>
<option value="10"<?php if(isset($_POST["month"]) && $_POST["month"] == "酉时(17点-下午19点)") echo 'selected="selected"';?>>酉时(17点-下午19点)</option>
<option value="11"<?php if(isset($_POST["month"]) && $_POST["month"] == "戌时(19点-晚上21点前)") echo 'selected="selected"';?>>戌时(19点-晚上21点前)</option>
<option value="12"<?php if(isset($_POST["month"]) && $_POST["month"] == "亥时(21点-晚上23点前)") echo 'selected="selected"';?>>亥时(21点-晚上23点前)</option>
</select>
<input type="submit" value="提交" />
</form>


<?
$month = $_POST['month'];
$filename = sprintf("1.txt");
$f = fopen($filename, "r");
if(!$f) {
die("文件:".$filename."不存在.");
}

$lines = array();
while(!feof($f)) {
$lines[] = fgets($f);
}
fclose($f);


for($i = 0; $i < count($lines); ++$i) {
if(preg_match_all('/[^\t]+/', $lines[$i], $m) > 0)
    $lines[$i] = $m[0];
}



echo "<table width=\"500\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#C5D5C5\" align=\"center\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"8\" cellspacing=\"1\">";
echo "<tr><td bgcolor=\"#F5F5F5\" align=\"center\" width=\"60\">时刻</td><td bgcolor=\"#FFFFFF\" style='font-size: 14px; font-weight: bold; color: #F00;'>$month</td></tr><tr><td bgcolor=\"#F5F5F5\" align=\"center\">左眼跳