注意
Jun 13, 2016 pm 12:29 PM
[MarsZ]ThinkPHP項目實戰(zhàn)總結
本文原word格式百度云盤下載地址:
http://pan.baidu.com/s/1qYqZFkg
綜述 2
需求 2
作者 2
系統(tǒng)一覽 2
Unity3d客戶端 2
PHP后臺 4
準備 6
XAMPP 6
官網(wǎng) 6
下載地址 6
教程 6
ThinkPHP 6
官網(wǎng) 7
項目所用版本 7
下載地址 7
快速入門 7
完全手冊 7
步驟 7
準備ThinkPHP 7
修改MySQL設置信息 8
檢測是否成功 9
擴展:控制器和模板 9
原則 9
添加控制器方法 9
添加界面模板 10
其他功能依此類推 10
注意 10
Thinkphp 10
比較標簽 10
數(shù)據(jù)讀取 10
Session 11
無法加載數(shù)據(jù)庫驅動: Think\Db\Driver\ 11
PHP 11
PHP全選和刪除 11
PHP處理Checkbox復選框表單提交 11
HTML 12
HTML框架 12
HTML框架如何進行同框架頁面跳轉(轉) 12
MySQL 12
MySQL創(chuàng)建數(shù)據(jù)庫 12
?
綜述
需求
這次的需求是:一個U3D應用需要學生登錄、學生注冊、學生密碼修改功能,相關后臺需要查看學生列表、學生信息修改、查看管理員列表、管理員信息修改和增加等功能。
綜合考慮后后臺采用PHP語言、ThinkPHP框架、MySQL數(shù)據(jù)庫。
作者
本文作者:MarsZ
QQ:569491198
交流群:498885177
版本:第一版
時間:2016年3月29日10:32:18
廢話:這個項目是我工作業(yè)余接的一個私活,業(yè)余時間做的,前后大約花了20小時的樣子。雖然本人是搞Unity3D的,但是不論之前搞Flash頁游開發(fā),還是現(xiàn)在搞U3D手游開發(fā),還是其他的,PHP都是個不錯的后臺語言,能實現(xiàn)很多功能需求。第一版還沒有加上UI美化,發(fā)完總結再說。這個總結一方面給有需要的朋友參考,一方面也是自己的一種習慣,做過的東西有必要的話寫下來,方便以后自己參考。
?
系統(tǒng)一覽
Unity3d客戶端
Unity3d前臺注冊:
?
Unity3d前臺注冊
Unity3d前臺登錄:
?
Unity3d前臺登錄
Unity3d前臺密碼找回:
?
Unity3d前臺密碼修改
PHP后臺
注意:本版本為第一版,還沒有加上UI美化修飾。
?
后臺登錄
?
?
后臺首頁-學生列表
?
后臺首頁-學生信息編輯
?
?
?
后臺首頁-賬號管理
?
后臺首頁-新建管理員
?
準備
XAMPP
(Apache+MySQL+PHP+PERL)是一個功能強大的建 XAMPP 軟件站集成軟件包,安裝完畢后就不用安裝Apache、MySQL及PHP了。
官網(wǎng)
http://www.xampps.com/
下載地址
http://www.xampps.com/xampp.zip?(必備)
?
教程
安裝方法:下載安裝包后一鍵安裝模式,傻瓜式,沒有需要解釋的
?
ThinkPHP?
官網(wǎng)
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并解壓到網(wǎng)站目錄,解壓完畢后的目錄結構為xampp\htdocs\ArtStudio:
?
網(wǎng)站目錄
?
修改MySQL設置信息
配置文件位于:xampp\htdocs\ArtStudio\Application\Common\Conf的config.php:
?
MySQL配置修改
?
檢測是否成功
訪問網(wǎng)址http://localhost/ArtStudio/index.php/Admin/Index/index
即可訪問Admin模塊的Index控制器的index方法,看到首頁了。
?
擴展:控制器和模板
原則
模板中提交數(shù)據(jù)到控制器中對應的方法,有參數(shù)就傳入?yún)?shù)。
添加控制器方法
打開xampp\htdocs\ArtStudio\Application\Admin\Controller下的IndexController.class.php
增加一個方法:public function login($as_admin_name,$as_admin_password)。
給定2個參數(shù)$as_admin_name,$as_admin_password。
?
?
控制器方法
添加界面模板
打開xampp\htdocs\ArtStudio\Application\Admin\View\Index下的index.html模板,
創(chuàng)建表單,提交到__URL__/login,對應控制器中的login方法,
傳入2個參數(shù)。
?
其他功能依此類推
?
注意
Thinkphp?
比較標簽
參考:
http://document.thinkphp.cn/manual_3_2.html#compare
格式:
相等
不相等
例子:
?
?
數(shù)據(jù)讀取
參考:
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
?
無法加載數(shù)據(jù)庫驅動: 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創(chuàng)建數(shù)據(jù)庫
參考:
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;//注意數(shù)據(jù)庫名字不要加引號
- 1樓牛腩
- 支持支持。。php is the best language..
- Re: MarsZhou
- @牛腩,thx

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

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.

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.

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

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.

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.

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

ThinkPHP installation steps: Prepare PHP, Composer, and MySQL environments. Create projects using Composer. Install the ThinkPHP framework and dependencies. Configure database connection. Generate application code. Launch the application and visit http://localhost:8000.
