注意
[MarsZ]ThinkPHP项目实战总结
本文原word格式百度云盘下载地址:
http://pan.baidu.com/s/1qYqZFkg
综述 2
需求 2
作者 2
系统一览 2
Unity3d客户端 2
PHP后台 4
准备 6
XAMPP 6
官网 6
下载地址 6
教程 6
ThinkPHP 6
官网 7
项目所用版本 7
下载地址 7
快速入门 7
完全手册 7
步骤 7
准备ThinkPHP 7
修改MySQL设置信息 8
检测是否成功 9
扩展:控制器和模板 9
原则 9
添加控制器方法 9
添加界面模板 10
其他功能依此类推 10
注意 10
Thinkphp 10
比较标签 10
数据读取 10
Session 11
无法加载数据库驱动: Think\Db\Driver\ 11
PHP 11
PHP全选和删除 11
PHP处理Checkbox复选框表单提交 11
HTML 12
HTML框架 12
HTML框架如何进行同框架页面跳转(转) 12
MySQL 12
MySQL创建数据库 12
综述
需求
这次的需求是:一个U3D应用需要学生登录、学生注册、学生密码修改功能,相关后台需要查看学生列表、学生信息修改、查看管理员列表、管理员信息修改和增加等功能。
综合考虑后后台采用PHP语言、ThinkPHP框架、MySQL数据库。
作者
本文作者:MarsZ
QQ:569491198
交流群:498885177
版本:第一版
时间:2016年3月29日10:32:18
废话:这个项目是我工作业余接的一个私活,业余时间做的,前后大约花了20小时的样子。虽然本人是搞Unity3D的,但是不论之前搞Flash页游开发,还是现在搞U3D手游开发,还是其他的,PHP都是个不错的后台语言,能实现很多功能需求。第一版还没有加上UI美化,发完总结再说。这个总结一方面给有需要的朋友参考,一方面也是自己的一种习惯,做过的东西有必要的话写下来,方便以后自己参考。
系统一览
Unity3d客户端
Unity3d前台注册:
Unity3d前台注册
Unity3d前台登录:
Unity3d前台登录
Unity3d前台密码找回:
Unity3d前台密码修改
PHP后台
注意:本版本为第一版,还没有加上UI美化修饰。
后台登录
后台首页-学生列表
后台首页-学生信息编辑
后台首页-账号管理
后台首页-新建管理员
准备
XAMPP
(Apache+MySQL+PHP+PERL)是一个功能强大的建 XAMPP 软件站集成软件包,安装完毕后就不用安装Apache、MySQL及PHP了。
官网
http://www.xampps.com/
下载地址
http://www.xampps.com/xampp.zip (必备)
教程
安装方法:下载安装包后一键安装模式,傻瓜式,没有需要解释的
ThinkPHP
官网
http://www.thinkphp.cn/
项目所用版本
http://www.thinkphp.cn/down/610.html
下载地址
http://www.thinkphp.cn/down/610.html (必备)
快速入门
http://www.kancloud.cn/thinkphp/thinkphp_quickstart (推荐)
完全手册
http://www.kancloud.cn/manual/thinkphp (参考)
步骤
准备ThinkPHP
下载ThinkPHP并解压到网站目录,解压完毕后的目录结构为xampp\htdocs\ArtStudio:
网站目录
修改MySQL设置信息
配置文件位于:xampp\htdocs\ArtStudio\Application\Common\Conf的config.php:
MySQL配置修改
检测是否成功
访问网址http://localhost/ArtStudio/index.php/Admin/Index/index
即可访问Admin模块的Index控制器的index方法,看到首页了。
扩展:控制器和模板
原则
模板中提交数据到控制器中对应的方法,有参数就传入参数。
添加控制器方法
打开xampp\htdocs\ArtStudio\Application\Admin\Controller下的IndexController.class.php
增加一个方法:public function login($as_admin_name,$as_admin_password)。
给定2个参数$as_admin_name,$as_admin_password。
控制器方法
添加界面模板
打开xampp\htdocs\ArtStudio\Application\Admin\View\Index下的index.html模板,
创建表单,提交到__URL__/login,对应控制器中的login方法,
传入2个参数。
其他功能依此类推
注意
Thinkphp
比较标签
参考:
http://document.thinkphp.cn/manual_3_2.html#compare
格式:
相等
不相等
例子:
数据读取
参考:
http://document.thinkphp.cn/manual_3_2.html#read_data
例子:
$User = M("User"); // 实例化User对象
// 获取ID为3的用户的昵称
$nickname = $User->where('id=3')->getField('nickname');
Session
参考:
http://www.kancloud.cn/manual/thinkphp/1872
格式:
session('name','value'); //设置session
ession('name',null); // 删除nam
例子:
session('user.user_id',10); //设置session
session('user.user_id',null); // 删除session
无法加载数据库驱动: Think\Db\Driver\
参考:
http://www.thinkphp.cn/topic/29611.html
PHP
PHP全选和删除
参考:
http:[email protected]/blog/static/853658012011118033893/
PHP处理Checkbox复选框表单提交
参考:
http://blog.csdn.net/sysprogram/article/details/42693295
HTML
HTML框架
参考:
http://www.w3school.com.cn/tiy/t.asp?f=html_frame_navigation2
http://www.w3school.com.cn/tiy/t.asp?f=html_frame_mix
HTML框架如何进行同框架页面跳转(转)
参考:
http://zhidao.baidu.com/link?url=PUHDL2v52ijVYv9bM19xgUG4ECpL9sKMla3ZaiRb_DQS5Yz4R5NaczOJ5bTqPcS6xezemagBcM0kRexND4bI2a
MySQL
MySQL创建数据库
参考:
http://outofmemory.cn/code-snippet/2533/mysql-create-database-specify-utf-8-coding
例子:
CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
USE DATABASEName;//注意数据库名字不要加引号
- 1楼牛腩
- 支持支持。。php is the best language..
- Re: MarsZhou
- @牛腩,thx

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

In iOS 17, Apple introduced several new privacy and security features to its mobile operating system, one of which is the ability to require two-step authentication for private browsing tabs in Safari. Here's how it works and how to turn it off. On an iPhone or iPad running iOS 17 or iPadOS 17, Apple's browser now requires Face ID/Touch ID authentication or a passcode if you have any Private Browsing tab open in Safari and then exit the session or app to access them again. In other words, if someone gets their hands on your iPhone or iPad while it's unlocked, they still won't be able to view your privacy without knowing your passcode

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

Performance comparison of Laravel and ThinkPHP frameworks: ThinkPHP generally performs better than Laravel, focusing on optimization and caching. Laravel performs well, but for complex applications, ThinkPHP may be a better fit.

HTTP Status Code 200: Explore the Meaning and Purpose of Successful Responses HTTP status codes are numeric codes used to indicate the status of a server's response. Among them, status code 200 indicates that the request has been successfully processed by the server. This article will explore the specific meaning and use of HTTP status code 200. First, let us understand the classification of HTTP status codes. Status codes are divided into five categories, namely 1xx, 2xx, 3xx, 4xx and 5xx. Among them, 2xx indicates a successful response. And 200 is the most common status code in 2xx
