PHP分页代码
头部调用
<?
require('conn.php');
$sql1="select id from news";
$query1=mysql_query($sql1,$conn);
$sun_num=mysql_num_rows($query1);
$gs=20;
$page_num=ceil($sun_num/$gs);
include("../subpage.php");
//传过来的页数参数
$PB_page=$_GET['PB_page'];
if ($PB_page==1 or empty($PB_page)){
$a=0;
}else{
$a=(($PB_page-1)*$gs);
}
?>
HTML部分代码
<div style="margin-top:10px;" mce_style="margin-top:10px;">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<form id="form1" name="form1" method="get" onsubmit="return checkkey()"> <tr>
<td width="9%" height="25" align="center">
<span style="color:#067098; font-weight:bold" mce_style="color:#067098; font-weight:bold">文章搜索:</span> </td>
<td width="25%" align="left"><input name="key" type="text" class="txt" id="key" size="40"/></td>
<td width="66%" align="left"><input type="submit" name="Submit" value="搜 索" /></td>
</tr>
</form>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="30" colspan="6" bgcolor="#FFFFFF" class="title" style="border-top:1px #B8D3E1 solid; border-bottom:1px #F7AC1B dashed" mce_style="border-top:1px #B8D3E1 solid; border-bottom:1px #F7AC1B dashed">新闻列表</td>
</tr>
<tr>
<td width="6%" height="25" align="center" bgcolor="#B5E9FF">ID</td>
<td width="63%" height="25" align="center" bgcolor="#B5E9FF">新闻标题</td>
<td width="8%" align="center" bgcolor="#B5E9FF">作者</td>
<td width="13%" align="center" bgcolor="#B5E9FF">添加时间</td>
<td colspan="2" align="center" bgcolor="#B5E9FF">操 作</td>
</tr>
<?
if (!$_GET[key]){
$sql="SELECT * from news order by id desc limit $a,$gs";
}else{
相关文档:
PHP创建文件(夹)以及目录操作
一、目录操作
首先是从目录读取的函数,opendir(),readdir(),closedir(),使用的时候是先打开文件句柄,而后迭代列出:
<?php
$base_dir="filelist/";
$fso=opendir($base_dir);
echo $base_dir."<hr/>";
whil ......
Code:
<?php
function genRandomString($len)
{
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", ......
configure: error: Unable to find libgd.(a|so)
如果使用的是ubuntu或debian就很简单了,直接sudo apt-get install apache2
libapache2-mod-php5 php5 php5-gd 就基本上搞定,但是用源代码安装还是很麻烦~
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0.11.tar.gz
cd gd-2.0.11
sudo . ......
数据库中查询到以下的结果:
cname linename minute
aa c1 & ......
在项目开发中发现对php的文档缺少管理,别人写了一个,功能不多
<?php
/**
* 类名: doc
*
描述: 文档生成类
* 其他: 可以对目录进行过滤,设置好源目录后,请用绝对路径指定生成目录,模式可调,模式
*
1为常规类型,即以 斜线**开头,以*斜线 结束
* 2为扩展类型,凡是 斜线*开头以*斜线 结束的部分都将成为文 ......