Menu

Tree [r12] /
 History

HTTPS access


File Date Author Commit
 APP 2014-01-09 haojingyang [r12]
 Data 2013-10-20 haojingyang [r6]
 Public 2013-10-16 haojingyang [r4]
 ThinkPHP 2013-10-20 haojingyang [r6]
 index.php 2013-10-11 haojingyang [r2]
 readme.php 2013-10-22 haojingyang [r7]
 wish2.sql 2013-11-25 haojingyang [r10]

Read Me

许愿墙步骤分析及知识点总结:
---------------------------------------------
A、建立应用独立分组

	a.开启调试功能(debug)

	b.定义独立分组配置项		(公共config)
		1) 'APP_GROUP_LIST'=>'Index,Admin',//应用分组列表
	   2) 'DEFAULT_GROUP'=>'Index',       //默认分组
	   3) 'APP_GROUP_MODE'=>1,            //开启独立分组
	   4) 'APP_GROUP_PATH'=>'Modules',    //独立分组路径,默认modules

	c.创建常用公共函数(p函数)

	d.定义连接数据库基本配置项	 (公共config)
		1) 'DB_HOST'=>'localhost',
		2) 'DB_USER'=>'root',
		3) 'DB_PWD'=>'',
		4) 'DB_NAME'=>'wish2',
		5) 'DB_PREFIX'=>'wish2_',
---------------------------------------------
B、搭建前台、后台

	a.创建基本目录结构Admin&Index(Action Conf MOdel Tpl...)

	b.创建前台Index控制器及模板调用
		1) 根下创建Public  前台css+js+img存放
		2) 指定模板路径默认连接方式
				'TMPL_FILE_DEPR'=>'_',(公共config)
		3) 创建index控制器,调用模板

	c.创建后台Index控制器及模板调用
		1) 指定后台Public
				'TMPL_PARSE_STRING'=>array(//模板路径替换
				'__PUBLIC__'=>__ROOT__.'/'.APP_NAME.'/Modules/'.GROUP_NAME.'/Tpl/Public',)(后台config)
		2) 创建index控制器,调用模板
---------------------------------------------
C、前台分配变量、实现异步发送

	a.创建wish表,分配变量,模板中foreach遍历数据库
		
	b.ajax发送、表单处理(Index/handle)
		1) 全局url定义:var handleUrl="{:U('Index/Index/handle','','')}";
		2) 非ajax方式进入处理(IS_AJAX),
			_404等异常页面指定:'TMPL_EXCEPTION_FILE'=>'./Public/Tpl/error.html'(前台config)			
		3)	对要插入内容处理:表情替换(replace_phiz,F)
		4) 插入数据库(data、add)、返回状态码(ajaxReturn)
---------------------------------------------
D、搭建后台登陆页面、调用验证码、登陆验证、退出

	a.搭建后台登陆页面

	b.调用验证码
		Image类的调用(验证码函数buildImageVerify)		
	
	c.登陆验证
		1) 登陆后台首页方式判断(IS_POST)
		2) 验证码验证session('verify')
		3) 账号和密码验证
		4) 判断是否锁定
		5) 将登陆信息更新到数据库
		6) 将登陆信息写入session
		7) 登陆成功跳到后台首页(函数redirect)

	d.登陆验证自动运行
		1) 创建Common公共控制器
		2)	判断session中的uid和username是否存在
		3) Index控制器继承Common
	
	e.退出登陆
		session_unset();//释放session
		session_destroy();//销毁session
		$this->redirect('Admin/Login/index');
---------------------------------------------
	



	
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.