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
){
$
相关文档:
1、mysql_connect()-建立数据库连接
格式:
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
例:
$conn = @mysql_connect(”localhost”, “username”, “password”) or dir(”不能连接到Mysql Server” ......
来源: 发布时间:2009-09-18 发布人: 浏览:30人次 字体:[大 中 小]
【1】页面之间无法传递变量 get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提交过来得变量要使用$_GET['foo'],$_POST['foo'],$_SESSION['foo']来得到
当然也可以修改自动全局变量为开(ph ......
目前,最常用的三种动态网页语言有ASP(Active Server Pages),JSP(Java Server Pages),
PHP (Hypertext Preprocessor)。
简 介
ASP全名Active Server & ......
PHP提供了大量的内置函数,使开发人员在时间的处理上游刃有余,大大提高了工作效率。我们今天就为学员介绍一些常见的PHP日期和时间函数以及日期和时间的处理。
9.1 常用的日期和时间处理函数
表9-1:常用的日期和时间处理函数
函 数
说 明
checkdate
验证时间函数,判断时间是否有效,有效返回true,否则返回fa ......