| 网站首页 | JAVA文章 | AppServers | Web开发 | 应用开发 | 资源下载 | 论坛
    学好外语能够获得更多的国外先进编程技术  [enadd  2006年12月25日]        
设为首页 加入收藏 联系站长
您现在的位置: 编程笔记网 >> Web开发 >> 网络编程 >> PHP编程 >> PHP经验技巧 >> 文章正文
用PHP5进行三层开发            【字体:
用PHP5进行三层开发
作者:未知    文章来源:-    点击数:    更新时间:2006-12-8


自动构建数据库模式

包含两个过程,构建数据库的对象-关系映射,和从example数据库user表中自动创建一个类.在表中的所有字段

名将成为类成员变量.


创建适当的模式:

C:\PHP\PEAR\DB\DataObject>C:\PHP\php.exe createTables.php \
 C:\dataobjects\example.ini


这将生成User.php文件:

<?php
/**
 * Table Definition for user
 * www.knowsky.com
 */
require_once 'DB/DataObject.php';

class DataObjects_User extends DB_DataObject
{
    ###START_AUTOCODE

    /* the code below is auto generated do not remove the above tag */
    var $__table = 'user';       // table name
    var $user_Id;                // int(11)  not_null primary_key auto_increment
    var $first_Name;             // string(30)  not_null
    var $last_Name;              // string(40)  not_null
    var $email;                  // string(100)  not_null

    /* Static get */
    function staticGet($k,$v=NULL) {
  return DB_DataObject::staticGet('DataObjects_User',$k,$v);
 }

    /* the code above is auto generated do not remove the tag below */
    ###END_AUTOCODE
}
?>

它还会为user表模式生成example.ini配置文件:

[user]
user_Id    = 129
first_Name = 130
last_Name  = 130
email      = 130

[user__keys]
user_Id = N


Smarty files
It's time to create several files for Smarty:

Smarty文件
现在是创建几个Smarty文件的时候了:

include.php
1 <?
2   require('Smarty.class.php');
3   $smarty = new Smarty;
4   $smarty->template_dir = 'templates/';
5   $smarty->compile_dir  = 'templates_c/';
6   $smarty->config_dir   = 'configs/';
7   $smarty->cache_dir    =  'cache/';
?>

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页  

文章录入:enadd    责任编辑:enadd 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
  • 用php发送带附件的Email

  • 用php实现gb2312和unicode间…

  • 解决RHAS3中Apache2的PHP上传…

  • 令你的网站获得任意Google P…

  • PHP和JAVA的XML-RPC中文问题…

  • 使用php通过Socket进行发信源…

  • PHP应用分页显示制作详细讲解

  • PHP下实现端口复用/劫持

  • PHP链接ACCESS数据库最简单的…

  • IIS 不用 rewrite 实现页面静…

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 |