易截截图软件、单文件、免安装、纯绿色、仅160KB

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中__FILE__常量用法简介

1.php中的__FILE__常量返回文件的完整路径和文件名.
2.dirname(__FILE___) 函数返回的是脚本所在在的路径。
比如文件 b.php 包含如下内容:
<?php
$basedir = dirname(__FILE__);
?>
如果b.php被其他目录里的a.php文件require 或者 include 去引用的话。
变量?$basedir 的内容还是b.php所在的那个文件夹 ......

php学习心得(适合php初学者)


来源: 发布时间:2009-09-18 发布人: 浏览:30人次  字体:[大 中 小]  
 【1】页面之间无法传递变量 get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提交过来得变量要使用$_GET['foo'],$_POST['foo'],$_SESSION['foo']来得到
当然也可以修改自动全局变量为开(ph ......

ASP、JSP与PHP 你会选谁

 目前,最常用的三种动态网页语言有ASP(Active   Server   Pages),JSP(Java   Server   Pages),  
  PHP   (Hypertext   Preprocessor)。    
   
  简   介    
   
    ASP全名Active   Server & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号