php模板技术
站点结构
代码:
站点
┗includes
┗class.inc
┣templet
┗index.htm
┣list.htm
┗content.htm
┣index.php
┗content.php
库结构
代码:
-- 数据库: `test`
-- 表的结构 `test`
CREATE TABLE `test` (
`id` smallint(3) NOT NULL auto_increment,
`name` varchar(10) NOT NULL default '',
`sex` enum('男','女') NOT NULL default '男',
`age` smallint(2) NOT NULL default '0',
`email` varchar(20) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
--------------- class.inc文件 --------
CODE:
<?
php
class
mycon
{
private
$myhost
;
private
$myuser
;
private
$mypwd
;
function
mycon
(
$host
=
"localhost"
,
$user
=
"root"
,
$pwd
=
""
){
$this
->
myhost
=
$host
;
$this
->
myuser
=
$user
;
$this
->
mypwd
=
$pwd
;
}
function
connect
(){
return
mysql_connect
(
$this
->
myhost
,
$this
->
myuser
,
$this
->
mypwd
);
}
}
class
templet
{
private
$source_file
;
function
get_file
(
$filename
){
$
相关文档:
今天想使用这一句php来判断一个文件是否存在: echo is_file('/var/downloads/donkey/incoming/[当地球停止转动].The.Day.The.Earth.Stood.Still.DVDRip.XviD-DMT.avi')?"true":"false";
echo is_file('/var/downloads/donkey/incoming/[当地球停止转动].The.Day.The.Earth.Stood.Still.DVDRip.XviD-DMT.avi')?"t ......
PHP提供了大量的内置函数,使开发人员在时间的处理上游刃有余,大大提高了工作效率。我们今天就为学员介绍一些常见的PHP日期和时间函数以及日期和时间的处理。
9.1 常用的日期和时间处理函数
表9-1:常用的日期和时间处理函数
函 数
说 明
checkdate
验证时间函数,判断时间是否有效,有效返回true,否则返回fa ......
不知不觉,5月过了大半了,想保持每个月至少给 Blog 添加一些新鲜的文章,也随便给自己的 career 轨迹做一个记录,于是提笔,呵呵~ 今天要介绍一下石头最新的作品 Hush Framework,这个框架是我这两个月的心血之作,本人还是比较满意的,以下会给大家介绍一些这个东东的亮点。这个作品的本意是为公司日后的应用开发提供一个 ......
插入代码
<?
$action=$_GET['action'];
switch($action){
//添加记录
case"add";
$mail = trim(htmlspecialchars($_POST["mail"]));
$username = trim(htmlspecialchars($_POST["username"]));
$tel = trim(htmlspecialchars($_POST["tel"]));
$fax = trim(htmlspecialchars($_POST["fax"]));
$c ......
wangjimima.php
<form id="form1" name="form1" method="post" action="mailto.php" onSubmit="return CheckForm()">
<input name="username" type="text" class="in" id="username" size="30" onmouseover="fEvent('mouseover',this)" onfocus="fEvent('focus',this)" onblur="fEvent('blur',this)" onmouseout ......