PHP分页类
<?php
/***************************
* 一个非常实用个性的分页类 *
****************************
*****************************实例***********************************
if(!isset($_GET['page'])){$page = 0;}else{$page = $_GET['page'];}
$pagedemo = new pageclass;
$pagedemo->set_sql("SELECT * from `demo` ORDER BY `id` DESC");
$pagedemo->set_params("type=".$type."");
$pagedemo->set_setpage($page);
$pagedemo->set_pagesize(10);
$pagedemo->set_filename("demo.php");
$pagedemo->set_pagenumber(5);
$pagedemo->show();
$result=$pagedemo->result;
$n=0;
while ($row=mysql_fetch_row($result)){
$n++;
echo "内容";
}
$pagedemo->showpage();
*******************************************************************/
class pageclass
{
/****声明****/
var $sqlstr,$filename,$params,$initfirstpage;
var $pagestart,$pagenumber,$pagesize,$i;
var $firstpage,$prevpage,$nextpage,$lastpage;
var $totallines,$maxpage,$totalpages,$result;
var $page,$final,$getpage,$param,$paramlist;
/****构造函数****/
function pageclass()
{
$this->set_initfirstpage("仅此一页"); // 设置只有一页时显示的文字;
$this->set_setpage(0); // 设置默认第一页为0;
$this->set_pagesize(10); // 设置默认记录数为10;
$this->set_params(""); // 设置默认参数列表为空;
$this->set_pagestart(0); // 设置默认分页起始数为0;
$this->set_pagenumber(5); &nbs
相关文档:
区别:
system() 输出并返回最后一行shell结果。
exec() 不输出结果,返回最后一行shell结果,所有结果可以保存到一个返回的数组里面。
passthru() 只调用命令,把命令的运行结果原样地直接输出到标准输出设备上。
相同点:都可以获得命令执行的状态码
////////////////////////////////////////////////////////// ......
1.基本类
//smarty_config.php
<?php
define('TEMPLATE_DIR','templates/');
define('COMPILE_DIR','templates_c/');
define('CONFIG_DIR','configs/');
define('CACHE_DIR','cache/');
?>
//View.class.php
<?php
//配置文件
require_once 'configs/smart_config.php';
//Smarty类
require('smarty/ ......
需要用的php的正规匹配汉字,在网上找了些文章看了以下,看到这个的时候感觉这篇文章写的很真实,忍不住转过来了。
原文地址:http://hi.baidu.com/comdeng/blog/item/f272362e47ce29564ec226c5.html
在javascript中,要判断字符串是中文是很简单的。比如:
var str = "php编程";
if (/^[\u4e00-\u9fa5]+$/.t ......
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays ......
test.php代码: view plaincopy to clipboardprint?
assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?>
assign("total",$t ......