<?php include_once 'function.php'; $string1 = '123测试一下,文本输出多个内容阿斯顿撒打扫打扫打扫打扫的的时候,能否'; echo "chinese:" . chinesesubstr($string1, 0, 20); echo '<br/>'; echo substr($string1, 0, 20); ?> <h3>判断指定年份是否为闰年</h3> <span>请输入一个四位数的年份</span> <form name="form1" method="post" action=""> <input type="text" name="txt_year" value="" size="20"><br/> <input type="submit" name="Button" value="计算"> </form> <?php if ($_POST['Button'] != "") { $year = $_POST['txt_year']; $result = checkyear($year); if ($result) { echo $year . '是闰年'; } else { echo $year . '不是'; } }
<table width="460" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFCC" bgcolor="#DFDFDF"> <?php $conn = mysql_connect("localhost", "root", "") or die("数据库服务器连接错误" . mysql_error()); mysql_select_db("db_database18", $conn) or die("数据库访问错误" . mysql_error()); mysql_query("set names gb2312"); $sql = mysql_query("select * from tb_affiche order by createtime desc limit 0,6"); $info = mysql_fetch_array($sql); if ($info == false) { echo "本站暂无公告信息!"; } else { do { ?> <tr bgcolor="#E3E3E3"> <td height="24" align="left" bgcolor="#FFFFFF"> <img src="images/xing.gif" width="9" height="9"> <?php echo chinesesubstr($info[title], 0, 30); if (strlen($info[title]) > 30) { echo "..."; } ?> </td> </tr> <?php } while ($info = mysql_fetch_array($sql)); } mysql_free_result($sql); //关闭记录集 mysql_close($conn); //关闭MySQL数据库服务器 ?> </table></td></tr>