├── doc ├── Gin_01.md ├── Go_01.md ├── README.md ├── ThinkPHP_02.md ├── mtest.md ├── NodeJS_install.md ├── PHP_01.md ├── NodeJS_01.md ├── jQuery_01.md ├── HTML_01.md └── ThinkPHP_01.md ├── code ├── Gin │ └── README.md ├── Go │ └── README.md ├── PHP │ └── README.md ├── README.md ├── React │ └── README.md └── ThinkPHP │ └── README.md ├── images ├── README.md ├── Gin │ └── README.md ├── Go │ └── README.md ├── NodeJS │ ├── README.md │ ├── 05.png │ ├── 12.png │ ├── 14.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 06@2x.png │ ├── 07@2x.png │ ├── 08@2x.png │ ├── 09@2x.png │ ├── 10@2x.png │ ├── 11@2x.png │ ├── 13@2x.png │ └── 15@2x.png ├── React │ └── README.md ├── jQuery │ ├── README.md │ ├── 01@2x.png │ ├── 02@2x.png │ ├── 03@2x.png │ └── 04@2x.png ├── php │ ├── README.md │ ├── 01.png │ └── 02.png ├── thinkphp │ ├── README.md │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 18.png │ ├── 01@2x.png │ ├── 02@2x.png │ ├── 03@2x.png │ ├── 04@2x.png │ ├── 05@2x.png │ ├── 06@2x.png │ ├── 07@2x.png │ ├── 08@2x.png │ ├── 09@2x.png │ ├── 10@2x.png │ ├── 11@2x.png │ ├── 17@2x.png │ └── 19@2x.png └── Html │ ├── logo.png │ ├── 01_登录首页.jpg │ ├── banner.gif │ ├── 登录背景01.png │ ├── 登录首页背景.jpg │ ├── login_bg.png │ ├── login_btn.gif │ ├── 登录web效果图.png │ ├── 登录背景01_01.png │ ├── 登录背景01_02.png │ ├── 登录背景01_03.png │ ├── 登录背景01_04.png │ ├── 登录背景01_05.png │ └── 后台用户登录psd文件.png ├── introduction.md ├── SUMMARY.md ├── .gitignore ├── README.md └── LICENSE /doc/Gin_01.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/Go_01.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/Gin/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/Go/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/PHP/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /introduction.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/React/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/ThinkPHP/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/Gin/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/Go/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/NodeJS/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/React/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/jQuery/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/php/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/thinkphp/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/php/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/php/01.png -------------------------------------------------------------------------------- /images/php/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/php/02.png -------------------------------------------------------------------------------- /images/Html/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/logo.png -------------------------------------------------------------------------------- /images/NodeJS/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/05.png -------------------------------------------------------------------------------- /images/NodeJS/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/12.png -------------------------------------------------------------------------------- /images/NodeJS/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/14.png -------------------------------------------------------------------------------- /images/NodeJS/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/16.png -------------------------------------------------------------------------------- /images/NodeJS/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/17.png -------------------------------------------------------------------------------- /images/NodeJS/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/18.png -------------------------------------------------------------------------------- /images/NodeJS/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/19.png -------------------------------------------------------------------------------- /images/NodeJS/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/20.png -------------------------------------------------------------------------------- /images/Html/01_登录首页.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/01_登录首页.jpg -------------------------------------------------------------------------------- /images/Html/banner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/banner.gif -------------------------------------------------------------------------------- /images/Html/登录背景01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录背景01.png -------------------------------------------------------------------------------- /images/Html/登录首页背景.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录首页背景.jpg -------------------------------------------------------------------------------- /images/NodeJS/06@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/06@2x.png -------------------------------------------------------------------------------- /images/NodeJS/07@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/07@2x.png -------------------------------------------------------------------------------- /images/NodeJS/08@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/08@2x.png -------------------------------------------------------------------------------- /images/NodeJS/09@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/09@2x.png -------------------------------------------------------------------------------- /images/NodeJS/10@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/10@2x.png -------------------------------------------------------------------------------- /images/NodeJS/11@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/11@2x.png -------------------------------------------------------------------------------- /images/NodeJS/13@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/13@2x.png -------------------------------------------------------------------------------- /images/NodeJS/15@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/NodeJS/15@2x.png -------------------------------------------------------------------------------- /images/jQuery/01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/jQuery/01@2x.png -------------------------------------------------------------------------------- /images/jQuery/02@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/jQuery/02@2x.png -------------------------------------------------------------------------------- /images/jQuery/03@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/jQuery/03@2x.png -------------------------------------------------------------------------------- /images/jQuery/04@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/jQuery/04@2x.png -------------------------------------------------------------------------------- /images/thinkphp/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/12.png -------------------------------------------------------------------------------- /images/thinkphp/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/13.png -------------------------------------------------------------------------------- /images/thinkphp/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/14.png -------------------------------------------------------------------------------- /images/thinkphp/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/15.png -------------------------------------------------------------------------------- /images/thinkphp/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/16.png -------------------------------------------------------------------------------- /images/thinkphp/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/18.png -------------------------------------------------------------------------------- /images/Html/login_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/login_bg.png -------------------------------------------------------------------------------- /images/Html/login_btn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/login_btn.gif -------------------------------------------------------------------------------- /images/Html/登录web效果图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录web效果图.png -------------------------------------------------------------------------------- /images/Html/登录背景01_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录背景01_01.png -------------------------------------------------------------------------------- /images/Html/登录背景01_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录背景01_02.png -------------------------------------------------------------------------------- /images/Html/登录背景01_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录背景01_03.png -------------------------------------------------------------------------------- /images/Html/登录背景01_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录背景01_04.png -------------------------------------------------------------------------------- /images/Html/登录背景01_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/登录背景01_05.png -------------------------------------------------------------------------------- /images/thinkphp/01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/01@2x.png -------------------------------------------------------------------------------- /images/thinkphp/02@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/02@2x.png -------------------------------------------------------------------------------- /images/thinkphp/03@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/03@2x.png -------------------------------------------------------------------------------- /images/thinkphp/04@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/04@2x.png -------------------------------------------------------------------------------- /images/thinkphp/05@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/05@2x.png -------------------------------------------------------------------------------- /images/thinkphp/06@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/06@2x.png -------------------------------------------------------------------------------- /images/thinkphp/07@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/07@2x.png -------------------------------------------------------------------------------- /images/thinkphp/08@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/08@2x.png -------------------------------------------------------------------------------- /images/thinkphp/09@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/09@2x.png -------------------------------------------------------------------------------- /images/thinkphp/10@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/10@2x.png -------------------------------------------------------------------------------- /images/thinkphp/11@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/11@2x.png -------------------------------------------------------------------------------- /images/thinkphp/17@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/17@2x.png -------------------------------------------------------------------------------- /images/thinkphp/19@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/thinkphp/19@2x.png -------------------------------------------------------------------------------- /doc/ThinkPHP_02.md: -------------------------------------------------------------------------------- 1 | ## 创建Main页面 2 | 3 | 4 | 5 | ## 创建UserList页面 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /images/Html/后台用户登录psd文件.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-ss-course/web2019/HEAD/images/Html/后台用户登录psd文件.png -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Introduction](README.md) 4 | * [Introduction](introduction.md) 5 | * [M\_test](mtest.md) 6 | 7 | -------------------------------------------------------------------------------- /doc/mtest.md: -------------------------------------------------------------------------------- 1 | [https://blog.csdn.net/TH226/article/details/83047495](https://blog.csdn.net/TH226/article/details/83047495) 2 | 3 | [https://github.com/achun/Go-Blog-In-Action](https://github.com/achun/Go-Blog-In-Action) 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/NodeJS_install.md: -------------------------------------------------------------------------------- 1 | # Linux平台下安装NodeJS 2 | ## 下载安装文件 3 | http://nodejs.cn/download/ 4 | ![](/images/NodeJS/05.png) 5 | ## 安装步骤 6 | 7 | ### 将安装文件上传到某个目录,并解压 8 | 9 | ![](/images/NodeJS/06@2x.png) 10 | 11 | ``` 12 | tar -xvf node-v12.13.0-linux-x64.tar.xz 13 | ``` 14 | ### 重命名文件夹并移动到/usr/local目录 15 | 16 | ``` 17 | mv node-v12.13.0-linux-x64 /usr/local/nodejs 18 | ``` 19 | ### 建立软链接 20 | 21 | ``` 22 | ln -s /usr/local/nodejs/bin/npm /usr/local/bin/ 23 | ln -s /usr/local/nodejs/bin/node /usr/local/bin/ 24 | ``` 25 | 26 | ### 检查安装结果 27 | ``` 28 | node -v 29 | ``` 30 | 31 | ![](/images/NodeJS/07@2x.png) 32 | 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # for Mac OS X System Files 2 | .DS_Store 3 | Thumbs.db 4 | 5 | # for emacs 6 | *~ 7 | [#]*[#] 8 | 9 | # for Eclipse 10 | *.project 11 | 12 | # for Logs and databases 13 | *.log 14 | 15 | # remove SVN 16 | .svn 17 | 18 | # for Xcode 19 | .*.swp 20 | .clang_complete 21 | *.xcodeproj/project.xcworkspace/ 22 | *.xcodeproj/xcuserdata/ 23 | 24 | # for IDEA 25 | */build/* 26 | .idea/* 27 | *.iml 28 | /out/* 29 | 30 | 31 | # Logs 32 | logs 33 | *.log 34 | 35 | # Runtime data 36 | pids 37 | *.pid 38 | *.seed 39 | 40 | # Directory for instrumented libs generated by jscoverage/JSCover 41 | lib-cov 42 | 43 | # Coverage directory used by tools like istanbul 44 | coverage 45 | 46 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 47 | .grunt 48 | 49 | # Compiled binary addons (http://nodejs.org/api/addons.html) 50 | build/Release 51 | 52 | # Dependency directory 53 | # Deployed apps should consider commenting this line out: 54 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 55 | node_modules 56 | 57 | _book/ 58 | book.pdf 59 | book.epub 60 | book.mobi 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 《互联网软件开发技术与实践》课程指导手册 2 | 3 | ### 实践**内容** 4 | 5 | * HTML+CSS制作登录页面 【[参考文档](/doc/HTML_01.md)】 6 | 7 | * PHP+MySQL实现用户登录 【[参考文档](/doc/PHP_01.md)】 8 | 9 | * ThinkPHP 5 + MySQL实现用户登录 【[参考文档](/doc/ThinkPHP_01.md)】 10 | 11 | * ThinkPHP 5 + X-admin的后台管理 【[参考文档](/doc/ThinkPHP_02.md)】 12 | 13 | * jQuery 实现用户登录功能前端验证 【[参考文档](/doc/jQuery_01.md)】 14 | 15 | * NodeJS + MySQL实现用户登录 【[参考文档](/doc/NodeJS_01.md)】 16 | 17 | * NodeJS + React实现用户登录 18 | 19 | * GoLang + MySQL实现用户登录 20 | 21 | * Gin + MySQL实现用户登录 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | # 著作权申明 30 | License: CC BY-NC-SA 4.0 31 | 32 | Creative Commons License 33 | - 本作品选择采用:署名-非商业性使用-相同方式共享 的CC协议。 34 | - 您可以:复制、发行、展览、表演、放映、广播或通过信息网络传播本作品。以及创作演绎作品。 35 | - 惟须遵守下列条件: 36 | - 署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。 37 | - 署名方式为:在转载或新作品开头的显著位置,注明原作者的姓名、来源及其采用的知识共享协议,与本作品在Github上的原发地址建立链接 38 | - 非商业性使用 — 您不得将本作品用于商业目的。 39 | - 相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。 40 | -------------------------------------------------------------------------------- /doc/PHP_01.md: -------------------------------------------------------------------------------- 1 | 2 | 页面分析: 3 | * 登录界面 login.html 4 | * 登陆处理页面 dologin.php 5 | * 登陆成功页面 welcome.php 6 | 7 | 登录页面 login.html 8 | 9 | ``` 10 | 11 | 12 | 13 | 14 | 登录 15 | 20 | 21 | 22 |
23 | 用户名:
24 | 密 码:
25 | 26 | 27 |
28 | 29 | ``` 30 | ![](/images/php/01.png) 31 | 32 | 33 | dologin.php 34 | 35 | 36 | 37 | ``` 38 | 39 | 40 | 41 | 42 | 登录系统的后台执行过程 43 | 44 | 45 | 64 | 68 | 73 | 77 | 82 | 85 | 90 | 91 | 92 | ``` 93 | 94 | welcome.php 95 | 96 | 97 | ``` 98 | 99 | 100 | 101 | 102 | 欢迎登录界面 103 | 104 | 105 | 106 | 109 | 欢迎登录
112 | 您的ip: 115 |
116 | 浏览器版本: 117 | 120 | 121 | 122 | 123 | 124 | ``` 125 | 126 | 127 | 128 | ![](/images/php/02.png) 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/NodeJS_01.md: -------------------------------------------------------------------------------- 1 | # NodeJS基础 2 | ## NodeJS是什么 3 | - Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。 4 | - Node.js 使用了一个事件驱动、非阻塞式 I/O 的模型。 5 | - Node 是一个让 JavaScript 运行在服务端的开发平台,它让 JavaScript 成为与PHP、Python、Perl、Ruby 等服务端语言平起平坐的脚本语言。 6 | - Node可以在不新增额外线程的情况下,依然可以对任务进行并发处理 —— Node.js是单线程的。 7 | - Node使用Module模块去划分不同的功能,以简化应用的开发。Modules模块有点像C++语言中的类库。每一个Node的类库都包含了十分丰富的各类函数,比如http模块就包含了和http功能相关的很多函数,可以帮助开发者很容易地对比如http,tcp/udp等进行操作,还可以很容易的创建http和tcp/udp的服务器。 8 | - 发布于2009年5月,由Ryan Dahl开发,实质是对Chrome V8引擎进行了封装。 9 | 10 | ## NodeJS运行环境安装 11 | 可以在你自己的笔记本安装,也可以在Linux服务器上安装。 12 | 13 | 安装方法参见[Linux安装步骤](/doc/NodeJS_install.md) 14 | 15 | ## 示例程序 16 | 17 | 文件名app.js 18 | 19 | ``` 20 | var http = require('http'); 21 | server = http.createServer(function (req, res) { 22 | res.writeHeader(200, {"Content-Type": "text/plain"}); 23 | res.end("Hello World\n"); 24 | }); 25 | server.listen(8000); 26 | console.log("httpd start @8000"); 27 | ``` 28 | 29 | 通过以下命令可以运行该node程序 30 | 31 | ![](/images/NodeJS/09@2x.png) 32 | 33 | 通过浏览器可访问该web应用(需要在服务器的安全策略中开放8000端口) 34 | ![](/images/NodeJS/08@2x.png) 35 | 36 | ## Express框架 37 | Express 是一个保持最小规模的灵活的 Node.js Web应用程序开发框架,为Web应用程序提供一组强大的功能。 38 | 39 | 40 | 假设已经安装了 Node.js,接下来为应用创建一个目录,然后进入此目录并将其作为当前工作目录 41 | 42 | 43 | ``` 44 | $ mkdir myapp 45 | $ cd myapp 46 | $ npm init 47 | $ npm install express -g --save 48 | 49 | ``` 50 | 过程截图如下: 51 | ![](/images/NodeJS/10@2x.png) 52 | ![](/images/NodeJS/11@2x.png) 53 | 54 | 新建index.js文件,程序代码如下 55 | ``` 56 | const express = require('express') 57 | const app = express() 58 | 59 | app.get('/', (req, res) => res.send('Hello World express!')) 60 | 61 | app.listen(3000, () => console.log('Example app listening on port 3000!')) 62 | ``` 63 | 64 | 65 | 运行程序 66 | 67 | ``` 68 | $ node index.js 69 | ``` 70 | 通过浏览器访问web应用,需放行相应的端口。 71 | ![](/images/NodeJS/12.png) 72 | 73 | ## Express 应用程序生成器 74 | 参考地址:http://www.expressjs.com.cn/starter/generator.html 75 | 76 | 77 | 安装express-generator 78 | 79 | ``` 80 | $ npm install express-generator --save -g 81 | ``` 82 | 83 | 创建了一个名称为myapp2的Express应用。并且设置Pug模板引擎 84 | 85 | 86 | ``` 87 | $ express --view=pug myapp2 88 | 89 | $ cd myapp2 90 | 91 | $ npm install 92 | 93 | $ DEBUG=myapp2:* npm start 94 | ``` 95 | 96 | ![](/images/NodeJS/13@2x.png) 97 | 98 | ![](/images/NodeJS/14.png) 99 | 100 | 101 | ## Express路由 102 | 103 | ``` 104 | app.get('/', function (req, res) { 105 | res.send('Hello World!') 106 | }) 107 | ``` 108 | 109 | ## 静态文件 110 | 为了提供诸如图像、CSS 文件和 JavaScript 文件之类的静态文件,请使用 Express 中的 express.static 内置中间件函数。 111 | 112 | 例如,通过如下代码就可以将 public 目录下的图片、CSS 文件、JavaScript 文件对外开放访问了: 113 | 114 | app.use(express.static('public')) 115 | 116 | 现在,你就可以访问 public 目录中的所有文件了: 117 | 118 | http://localhost:3000/images/kitten.jpg 119 | 120 | http://localhost:3000/css/style.css 121 | 122 | http://localhost:3000/js/app.js 123 | 124 | http://localhost:3000/images/bg.png 125 | 126 | http://localhost:3000/hello.html 127 | 128 | 129 | # NodeJS+Express+Mysql实现用户登录 130 | 131 | ## 创建项目 132 | 133 | 134 | ``` 135 | $ mkdir loginDemo 136 | $ cd loginDemo 137 | $ npm init 138 | ``` 139 | 140 | 141 | ## 编写登录页面代码 142 | 文件名 index.html 143 | 144 | 145 | ``` 146 | 147 | 148 | 149 | 150 | Title 151 | 152 | 153 |
154 | 155 | 156 | 157 |
158 | 159 | 160 | 161 | ``` 162 | 注意:此时运行程序是无法访问到index.html页面的 163 | 164 | ## 使用express框架 165 | 166 | 创建app.js文件,代码如下 167 | ``` 168 | var express=require('express'); 169 | var app=express(); 170 | 171 | app.get('/',function (req,res) { 172 | res.sendfile(__dirname + "/" + "index.html" ); 173 | }) 174 | 175 | 176 | var server=app.listen(3000,function () { 177 | console.log("start"); 178 | }) 179 | ``` 180 | 181 | 安装express模块 182 | 183 | 184 | ``` 185 | $ npm install express 186 | ``` 187 | 188 | 启动程序 189 | 190 | 191 | ``` 192 | $ node app.js 193 | ``` 194 | 195 | ![](/images/NodeJS/15@2x.png) 196 | 197 | ## 编写验证登录功能代码 198 | 完整代码如下: 199 | 200 | 201 | ``` 202 | var express=require('express'); 203 | var app=express(); 204 | var mysql=require('mysql'); 205 | var utility=require("utility"); 206 | var bodyParser = require('body-parser'); 207 | 208 | /** 209 | * 配置MySql 210 | */ 211 | var connection = mysql.createConnection({ 212 | host : 'localhost', 213 | user : 'demo1023_zhangq', 214 | password : '68EytEGc4h', 215 | database : 'demo1023_zhangq', 216 | port:'3306' 217 | }); 218 | connection.connect(); 219 | app.get('/',function (req,res) { 220 | res.sendfile(__dirname + "/" + "index.html" ); 221 | }) 222 | 223 | /** 224 | * 实现登录验证功能 225 | */ 226 | app.use(bodyParser.urlencoded({extended:false})); 227 | app.post('/login',function (req,res) { 228 | var name = req.body.name; 229 | var pwd = req.body.pwd; 230 | var selectSQL = "select * from users where user_name = '"+name+"' and user_pwd = '"+ utility.md5(pwd)+"'"; 231 | console.log(selectSQL); 232 | connection.query(selectSQL,function (err,rs) { 233 | if (err) throw err; 234 | console.log(rs); 235 | res.type('text/plain'); 236 | if(rs.length > 0 ){ 237 | res.send('登陆成功!'); 238 | }else 239 | { 240 | res.send('用户名或密码错误!'); 241 | } 242 | }) 243 | }) 244 | 245 | 246 | var server=app.listen(3000,function () { 247 | console.log("start"); 248 | }) 249 | ``` 250 | 安装程序所需的组件 251 | 252 | 253 | ``` 254 | $ npm install mysql 255 | $ npm install utility 256 | $ npm install body-parser 257 | 258 | ``` 259 | 运行程序 260 | 261 | ![](/images/NodeJS/16.png) 262 | ![](/images/NodeJS/17.png) 263 | ![](/images/NodeJS/18.png) 264 | ![](/images/NodeJS/19.png) 265 | ![](/images/NodeJS/20.png) 266 | 267 | 268 | 269 | 270 | 271 | 272 | -------------------------------------------------------------------------------- /doc/jQuery_01.md: -------------------------------------------------------------------------------- 1 | # jQuery基础 2 | 3 | ## jQuery是什么 4 | 5 | - jQuery是一个快速、简洁的JavaScript框架. 6 | - jQuery设计的宗旨是“write Less,Do More”,即倡导写更少的代码,做更多的事情。它封装JavaScript常用的功能代码,提供一种简便的JavaScript设计模式,优化HTML文档操作、事件处理、动画设计和Ajax交互。 7 | - jQuery的核心特性可以总结为:具有独特的链式语法和短小清晰的多功能接口;具有高效灵活的css选择器,并且可对CSS选择器进行扩展;拥有便捷的插件扩展机制和丰富的插件。jQuery兼容各种主流浏览器,如IE 6.0+、FF 1.5+、Safari 2.0+、Opera 9.0+等。 8 | - jQuery官网地址 https://jquery.com/ 9 | 10 | ## DOM 11 | 12 | - DOM 是 Document Object Model(文档对象模型)的缩写。 13 | - DOM 是 W3C(万维网联盟)的标准接口规范,是一种处理HTML和XML文件的标准API。 14 | - HTML DOM - 针对 HTML 文档的标准模型,是关于如何获取、修改、添加或删除 HTML 元素的标准。 15 | - DOM树结构精确地描述了HTML文档中标签间的相互关联性。将HTML文档转化为DOM树的过程称为解析(parse)。 16 | - HTML文档被解析后,转化为DOM树,因此对HTML文档的处理可以通过对DOM树的操作实现。 17 | 18 | ## jQuery文件说明 19 | jQuery文件的文件名通常为jquery.min.js 或 jquery.js 20 | - jquery.min.js(Production version) - 用于实际上线的Web系统,是精简和压缩的版本。 21 | - jquery.js(Development version) - 用于测试和开发的系统中使用,是未压缩,可读性好的版本。 22 | 23 | ## jQuery使用方式 24 | 25 | ### 下载jquery.js文件到本地 26 | ``` 27 | 28 | 29 | 30 | ``` 31 | ### 可以通过CDN(内容分发网络)引用 32 | 33 | ``` 34 | 35 | ``` 36 | 37 | ## jQuery 选择器 38 | - jQuery 选择器是如何准确地选取DOM树中的元素。 39 | - jQuery 元素选择器和属性选择器允许通过标签名、属性名或内容对 HTML 元素进行选择。 40 | - jQuery 元素选择器使用 CSS 选择器来选取 HTML 元素 41 | - jQuery 属性选择器使用 XPath 表达式来选择带有给定属性的元素 42 | - jQuery CSS 选择器可用于改变 HTML 元素的 CSS 属性 43 | 44 | ``` 45 | $("p") 选取

元素。 46 | $("p.intro") 选取所有 class="intro" 的

元素。 47 | $("p#demo") 选取所有 id="demo" 的

元素。 48 | $("[href]") 选取所有带有 href 属性的元素。 49 | $("[href='#']") 选取所有带有 href 值等于 "#" 的元素。 50 | $("[href!='#']") 选取所有带有 href 值不等于 "#" 的元素。 51 | $("[href$='.jpg']") 选取所有 href 值以 ".jpg" 结尾的元素。 52 | $("p").css("background-color","red") 把所有 p 元素的背景颜色更改为红色 53 | ``` 54 | 55 | 56 | 57 | ## jQuery示例 58 | 59 | 示例1:Get the 124 | 125 | 126 | ``` 127 | 128 | ajax() 方法有几个重要参数: 129 | ``` 130 | $.ajax({ 131 | url: "detail.html", //发送请求的地址,String类型的参数 132 | data:{id:"id"}, //发送到服务器的数据,Object或String类型的参数,如果已经不是字符串,将自动转换为字符串格式。 133 | type: "POST", //请求方式,默认为GET,String类型的参数 134 | dataType:'json', //预期服务器返回的数据类型,String类型的参数;可用类型有(xml,html,json,jsonp,text) 135 | timeout:1000, //请求超时时间,毫秒 136 | async: true, // 默认为true,所有请求均为异步请求,Boolean类型的参数 137 | beforeSend:function(XMLHttpRequest){ //发送请求前调用的函数 138 | 139 | }, 140 | complete:function(XMLHttpRequest, textStatus){ //请求完成后调用的回调函数(请求成功或失败时均调用) 141 | 142 | }, 143 | 144 | success:function(){ //请求成功后调用的回调函数 145 | 146 | }, 147 | error:function(){ //请求失败时被调用的函数 148 | 149 | } 150 | }); 151 | ``` 152 | 153 | 154 | 添加ajax验证用户名密码的代码如下 155 | 156 | ``` 157 | 158 | 159 | 160 | 登录示例 161 | 162 | 163 | 164 |

用户登录

165 | 166 | 167 |
168 | 169 | 170 | 171 | 199 | 200 | 201 | 202 | 203 | 204 | ``` 205 | 206 | 输入用户名密码后,点击提交无反应 207 | ![](/images/jQuery/01@2x.png) 208 | 209 | login.php代码如下 210 | 211 | 212 | ``` 213 | 0); 217 | 218 | exit(json_encode($arr)); 219 | 220 | ?> 221 | ``` 222 | 223 | 为了模拟后台到数据库的验证的结果。这里略过验证过程,直接通过返回JSON值来表示验证结果。通过修改success的值来模拟该接口的返回值。 1代表后台用户名密码验证成功,0代表后台用户名密码验证失败 224 | 225 | ![](/images/jQuery/02@2x.png) 226 | 此时可以输入用户名和密码进行登录测试。 227 | 228 | 229 | ![](/images/jQuery/03@2x.png) 230 | 231 | ![](/images/jQuery/04@2x.png) 232 | 233 | 234 | 使用$.ajax()方法代码如下: 235 | 236 | 237 | ``` 238 | $.ajax({ 239 | type:'POST', //提交方法是POST 240 | url:'/login.php', //请求的路径 241 | data:{"username":username,"password":password}, //以JSON字符串形式把 user 传到后台 242 | dataType:'JSON', //后台返回的数据类型是html文本 243 | timeout:1000, //请求超时时间,毫秒 244 | error:function(){ //请求失败的回调方法 245 | $("#errormessage").text("数据请求异常"); 246 | }, 247 | success:function(result){ //请求成功的回调方法 248 | if(result.success == 1){ 249 | window.location.href="index.html"; 250 | }else if(result.success == 0){ 251 | $("#errormessage").text("用户名或密码错误"); 252 | }else{ 253 | $("#errormessage").text("请求数据错误"); 254 | } 255 | } 256 | }); 257 | ``` 258 | 259 | 260 | 261 | 262 | 263 | 264 | -------------------------------------------------------------------------------- /doc/HTML_01.md: -------------------------------------------------------------------------------- 1 | # HTML是什么 2 | 超文本标记语言(英语:HyperText Markup Language,简称:HTML)是一种用于创建网页的标准标记语言。 3 | ``` 4 | 5 | 6 | 7 | 8 | 9 | 10 | 文档标题 11 | 12 | 13 |

一行文字

14 |

一个段落

15 | 16 | 17 | 18 | ``` 19 | 20 | ## HTML中的行内元素常用标签 21 | ### **a** 22 | * ``标签定义超链接,用于从一张页面链接到另一张页面 23 | * href 属性指示链接的目标 24 | * 示例:`内容` 25 | * 绝对路径: 26 | * 相对路径: 27 | ### img 28 | ### input 29 | ### select 30 | ### span 31 | ### br 32 | ### b 33 | ### strong 34 | ### button 35 | 36 | ### 特点 37 | * 和其他元素都在一行 38 | * 宽度只与内容有关,设宽度无效 39 | * 行内元素只能包含文本或其他行内元 素,不能包含块级元素 40 | 41 | 42 | ## HTML中的块级元素常用标签 43 | ### h 44 | ### p 45 | ### ul 46 | ### ol 47 | ### dl 48 | ### p 49 | ### div 50 | ### table 51 | ### form 52 | ### hr 53 | ### pre 54 | ### blockquote 55 | 56 | ### 特点 57 | * 总是从新的一行开始 58 | * 高度、宽度都是可控的 59 | * 宽度没有设置时,默认为100% 60 | * 块级元素中可以包含块级元素和行内元素 61 | 62 | # CSS 63 | * 层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML或XML等文件样式的计算机语言。 64 | * CSS 能够对网页中元素位置的排版进行像素级精确控制,支持几乎所有的字体字号样式,拥有对网页对象和模型样式编辑的能力。 65 | * 样式通常保存在外部的 .css 文件中。只需要编辑一个简单的 CSS 文档就可以指定页面的布局和外观。 66 | 67 | ## CSS引用方式 68 | 69 | ## CSS选择器 70 | 71 | ## CSS盒模型 72 | 73 | ## CSS定位 74 | 75 | ## CSS浮动 76 | *div是块元素,不会进行横向排列,因此如果想让两个div水平排列,需要使用浮动方式。* 77 | 78 | 79 | ## CSS布局 80 | 81 | 82 | # 实践内容 83 | **任务要求:根据给定的PSD格式文件的界面原图,制作Web页面** 84 | 85 | ![](/images/Html/01_登录首页.jpg) 86 | 87 | ![](/images/Html/登录web效果图.png) 88 | **需要了解Photoshop的以下操作 89 | * 图层管理 90 | * 切图操作 91 | * 测量尺寸 92 | 93 | ## 实践过程 94 | [psd原图下载](http://webdev.zhangqx.com/doc/01_登录首页.psd) 95 | **1、创建目录结构及相应的文件** 96 | ***** 97 | |--- css 98 | 99 | |--- |--- style.css 100 | 101 | |--- images 102 | 103 | |--- index.html 104 | 105 | ***** 106 | **2、编写index.html文件主体代码** 107 | ``` 108 | 109 | 110 | 111 | 教学课件管理系统--北京大学软件与微电子学院 112 | 113 | 114 | 115 | 116 | 117 | ``` 118 | **3、设置页面背景** 119 | 在Photoshop中,将界面的背景图截取出来。 120 | ![](/images/Html/登录背景01.png) 121 | 保存为jpg格式图片,文件名为“bj.jpg”,如下图所示, 122 | ![](/images/Html/登录首页背景.jpg) 123 | 将该文件保存到images文件夹内 124 | ***** 125 | |--- css 126 | 127 | |--- |--- style.css 128 | 129 | |--- images 130 | 131 | |--- |--- bj.jpg 132 | 133 | |--- index.html 134 | 135 | ***** 136 | 在index.html的body中增加一个div,代码如下: 137 | ``` 138 |
139 |
140 |
141 |
142 | ``` 143 | 在html文件的head引入css样式文件。如下所示 144 | `` 145 | 修改"style.css"文件,设置页面背景 146 | ``` 147 | /*-----------------------------全局样式-------------------------------------*/ 148 | *{margin:0;padding:0} 149 | li{list-style:none} 150 | img{vertical-align:top;border:none} 151 | legend{display:none} 152 | fieldset{border:none} 153 | a{text-decoration:none} 154 | a:hover,a:active{text-decoration:none} 155 | .clear {clear: both; } 156 | 157 | /*-----------------------------登录页面-------------------------------------*/ 158 | body{font:12px/1.5 Microsoft YaHei;position:relative;margin:0 auto;color:#000} 159 | #container{ 160 | width:960px; 161 | box-shadow: 0 0 15px #999999; 162 | margin: 0 auto; 163 | overflow-x: hidden; 164 | position: relative; 165 | } 166 | 167 | .login{background:#0c7fc2 url(/images/Html/bg.jpg) no-repeat center top ;height:600px} 168 | ``` 169 | 效果图如下所示 170 | ![](/images/Html/登录背景01_01.png) 171 | **4、添加LOGO** 172 | 173 | ![](/images/Html/logo.png) 174 | ``` 175 |
176 |
177 | 179 |
180 |
181 | ``` 182 | 183 | ``` 184 | .login_hd{background:url(/images/Html/logo.png) no-repeat;float:left;margin:20px 20px 0;width:423px;height:57px;} 185 | ``` 186 | 187 | ![](/images/Html/登录背景01_02.png) 188 | 189 | 190 | **5、添加登录框背景** 191 | ![](/images/Html/banner.gif) 192 | ![](/images/Html/login_bg.png) 193 | ``` 194 |
195 |
196 | 198 |
199 |
200 | 202 | 204 |
205 |
206 | ``` 207 | ``` 208 | .login_banner{background:url(/images/Html/banner.gif) no-repeat;float:left;margin:210px 80px 0;width:310px;height:53px;} 209 | .login_main{position:relative; background:url(/images/Html/login_bg.png) no-repeat;float:right;margin:110px 50px 50px;width:390px;height:240px;} 210 | ``` 211 | ![](/images/Html/登录背景01_03.png) 212 | 213 | **6、添加表单** 214 | ![](/images/Html/login_btn.gif) 215 | ``` 216 |
217 |
218 | 220 |
221 |
222 | 224 | 237 |
238 |
239 | ``` 240 | 241 | ``` 242 | .login_help{float:right;margin:6px -16px 10px;width:100px;height:30px;font-size:14px;color:#1e7bbd} 243 | .login_help a{color:#0101ff} 244 | .login_form{width:272px;height:170px;padding:27px 28px 0 26px;color:#000101;position:relative; } 245 | .username{height:57px;margin:52px 90px 13px} 246 | .password{height:57px;margin:-25px 90px 13px;} 247 | .username input,.password input{width:176px;height:32px;border:0;color:#999;font-size:14px;line-height:32px} 248 | .username input{position:absolute; top:87px; left:150px; } 249 | .password input{position:absolute; top:134px; left:150px; } 250 | .login_btn{text-align:center;height:42px;margin:0;position:absolute; top:170px; left:150px; } 251 | .login_btn input{background:url(/images/Html/login_btn.gif) no-repeat;border:0;width:68px;height:42px;cursor:pointer;text-indent:-9999px;*text-indent:0;*line-height:9999px;overflow:hidden} 252 | ``` 253 | 254 | ![](/images/Html/登录背景01_04.png) 255 | **7、添加附件文字内容** 256 | 257 | ``` 258 |
259 |
260 | 262 |
263 |
264 | 266 | 282 |
283 |
284 | ``` 285 | 286 | ``` 287 | .guest{float:left;margin:0px 20px 0;height:30px;font-size:14px;position:absolute; top:200px; left:0px; width:350px;text-align:center;color:#f00} 288 | .guest a{color:#0101ff} 289 | .forget{float:right;margin:0px 20px 0;height:30px;font-size:14px;position:absolute; top:175px; left:250px; } 290 | .forget a{color:#ff0000} 291 | .first{float:right;margin:10px 0px 0;width:350px;height:50px;color:#fff;position:absolute; top:230px; left:40px;} 292 | 293 | ``` 294 | ![](/images/Html/登录背景01_05.png) 295 | 296 | ## 本实践项目完整代码 297 | **index.html 文件** 298 | ``` 299 | 300 | 301 | 302 | 教学课件管理系统--北京大学软件与微电子学院 303 | 304 | 305 | 306 |
307 |
308 | 310 |
311 |
312 | 314 | 330 |
331 |
332 | 333 | 334 | ``` 335 | ***** 336 | ***** 337 | **style.css 文件** 338 | ``` 339 | 340 | /*-----------------------------全局样式-------------------------------------*/ 341 | 342 | *{margin:0;padding:0} 343 | li{list-style:none} 344 | img{vertical-align:top;border:none} 345 | legend{display:none} 346 | fieldset{border:none} 347 | a{text-decoration:none} 348 | a:hover,a:active{text-decoration:none} 349 | .clear {clear: both; } 350 | 351 | /*-----------------------------登录页面-------------------------------------*/ 352 | 353 | body{font:12px/1.5 Microsoft YaHei;position:relative;margin:0 auto;color:#000} 354 | #container{ 355 | width:960px; 356 | box-shadow: 0 0 15px #999999; 357 | margin: 0 auto; 358 | overflow-x: hidden; 359 | position: relative; 360 | } 361 | 362 | .login{background:#0c7fc2 url(/images/Html/bg.jpg) no-repeat center top ;height:600px} 363 | 364 | .login_hd{background:url(/images/Html/logo.png) no-repeat;float:left;margin:20px 20px 0;width:423px;height:57px;} 365 | 366 | .login_banner{background:url(/images/Html/banner.gif) no-repeat;float:left;margin:210px 80px 0;width:310px;height:53px;} 367 | .login_main{position:relative; background:url(/images/Html/login_bg.png) no-repeat;float:right;margin:110px 50px 50px;width:390px;height:240px;} 368 | 369 | 370 | .login_help{float:right;margin:6px -16px 10px;width:100px;height:30px;font-size:14px;color:#1e7bbd} 371 | .login_help a{color:#0101ff} 372 | .login_form{width:272px;height:170px;padding:27px 28px 0 26px;color:#000101;position:relative; } 373 | .username{height:57px;margin:52px 90px 13px} 374 | .password{height:57px;margin:-25px 90px 13px;} 375 | .username input,.password input{width:176px;height:32px;border:0;color:#999;font-size:14px;line-height:32px} 376 | .username input{position:absolute; top:87px; left:150px; } 377 | .password input{position:absolute; top:134px; left:150px; } 378 | .login_btn{text-align:center;height:42px;margin:0;position:absolute; top:170px; left:150px; } 379 | .login_btn input{background:url(/images/Html/login_btn.gif) no-repeat;border:0;width:68px;height:42px;cursor:pointer;text-indent:-9999px;*text-indent:0;*line-height:9999px;overflow:hidden} 380 | 381 | 382 | .guest{float:left;margin:0px 20px 0;height:30px;font-size:14px;position:absolute; top:200px; left:0px; width:350px;text-align:center;color:#f00} 383 | .guest a{color:#0101ff} 384 | .forget{float:right;margin:0px 20px 0;height:30px;font-size:14px;position:absolute; top:175px; left:250px; } 385 | .forget a{color:#ff0000} 386 | .first{float:right;margin:10px 0px 0;width:350px;height:50px;color:#fff;position:absolute; top:230px; left:40px;} 387 | ``` 388 | 389 | [项目示例代码下载](http://webdev.zhangqx.com/doc/web01.zip) 390 | 391 | ## 课后练手任务 392 | 自行到网络上下载免费或收费的用户登录界面PSD格式文件。并制作成Web格式页面。 393 | ![](/images/Html/后台用户登录psd文件.png) 394 | 395 | 396 | -------------------------------------------------------------------------------- /doc/ThinkPHP_01.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | * [一、创建ThinkPHP站点](#一、创建ThinkPHP站点) 5 | * [二、设计登录静态页面](#二、设计登录静态页面) 6 | * [三、配置数据库连接并创建表](#三、配置数据库连接并创建表) 7 | * [四、实现登录功能](#四、实现登录功能) 8 | * [五、引入css样式](#五、引入css样式) 9 | * [六、获取cookie值](#六、获取cookie值) 10 | 11 | **开发环境说明** 12 | 13 | - PHP 5.4 14 | - MySQL 5.5 15 | - ThinkPHP 5.0 16 | - CentOS Linux 7.2 17 | - Nginx 1.10.10 18 | - 宝塔Linux主机管理软件 7.0.1 19 | - phpMyAdmin 4.4 20 | 21 | 22 | 23 | 24 | ## 一、创建ThinkPHP站点 25 | 26 | 为了方便,使用宝塔工具创建ThinkPHP站点,并将域名demo1023.zhangqx.com解析到该服务器IP 27 | 28 | --- 29 | 30 | 31 | ![](/images/thinkphp/01@2x.png) 32 | 33 | --- 34 | 35 | 创建成功后的目录结构如下图所示 36 | 37 | ![](/images/thinkphp/02@2x.png) 38 | 39 | --- 40 | 41 | ThinkPHP官网的帮助文档中的目录结构如下: 42 | 43 | 44 | ``` 45 | 46 | project 应用部署目录 47 | ├─application 应用目录(可设置) 48 | │ ├─common 公共模块目录(可更改) 49 | │ ├─index 模块目录(可更改) 50 | │ │ ├─config.php 模块配置文件 51 | │ │ ├─common.php 模块函数文件 52 | │ │ ├─controller 控制器目录 53 | │ │ ├─model 模型目录 54 | │ │ ├─view 视图目录 55 | │ │ └─ ... 更多类库目录 56 | │ ├─command.php 命令行工具配置文件 57 | │ ├─common.php 应用公共(函数)文件 58 | │ ├─config.php 应用(公共)配置文件 59 | │ ├─database.php 数据库配置文件 60 | │ ├─tags.php 应用行为扩展定义文件 61 | │ └─route.php 路由配置文件 62 | ├─extend 扩展类库目录(可定义) 63 | ├─public WEB 部署目录(对外访问目录) 64 | │ ├─static 静态资源存放目录(css,js,image) 65 | │ ├─index.php 应用入口文件 66 | │ ├─router.php 快速测试文件 67 | │ └─.htaccess 用于 apache 的重写 68 | ├─runtime 应用的运行时目录(可写,可设置) 69 | ├─vendor 第三方类库目录(Composer) 70 | ├─thinkphp 框架系统目录 71 | │ ├─lang 语言包目录 72 | │ ├─library 框架核心类库目录 73 | │ │ ├─think Think 类库包目录 74 | │ │ └─traits 系统 Traits 目录 75 | │ ├─tpl 系统模板目录 76 | │ ├─.htaccess 用于 apache 的重写 77 | │ ├─.travis.yml CI 定义文件 78 | │ ├─base.php 基础定义文件 79 | │ ├─composer.json composer 定义文件 80 | │ ├─console.php 控制台入口文件 81 | │ ├─convention.php 惯例配置文件 82 | │ ├─helper.php 助手函数文件(可选) 83 | │ ├─LICENSE.txt 授权说明文件 84 | │ ├─phpunit.xml 单元测试配置文件 85 | │ ├─README.md README 文件 86 | │ └─start.php 框架引导文件 87 | ├─build.php 自动生成定义文件(参考) 88 | ├─composer.json composer 定义文件 89 | ├─LICENSE.txt 授权说明文件 90 | ├─README.md README 文件 91 | ├─think 命令行入口文件 92 | 93 | ``` 94 | 95 | 96 | - linux环境下,确保runtime目录有可写权限 97 | - 5.0的部署建议是public目录作为web目录访问内容 98 | 99 | 100 | --- 101 | 102 | 103 | **将域名解析到服务器主机IP** 104 | 105 | ![](/images/thinkphp/03@2x.png) 106 | 107 | **确保域名被正确的解析到主机IP,可在本地机器通过ping命令来测试** 108 | 109 | ![](/images/thinkphp/04@2x.png) 110 | 111 | **通过浏览器打开站点** 112 | 113 | ![](/images/thinkphp/05@2x.png) 114 | 115 | 在application/index/controller目录下的index.php文件内容如下: 116 | 117 | 118 | ``` 119 | *{ padding: 0; margin: 0; } .think_default_text{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:)

ThinkPHP V5
十年磨一剑 - 为API开发设计的高性能框架

[ V5.0 版本由 七牛云 独家赞助发布 ]
'; 127 | } 128 | } 129 | 130 | ``` 131 | 将该文件的内容修改如下: 132 | ``` 133 | 237 | 238 | 239 | 登录示例 240 | 241 | 242 |

用户登录

243 |
244 | 245 | 246 | 247 |
248 | 249 | 250 | ``` 251 | 252 | 253 | 254 | 在login方法中,调用fetch方法。代码如下 255 | 256 | 257 | ``` 258 | fetch(); 273 | } 274 | } 275 | 276 | ``` 277 | 278 | 279 | 访问http://demo1023.zhangqx.com/index.php/index/index/login/ 显示结果如下: 280 | ![](/images/thinkphp/10@2x.png) 281 | 282 | ## 三、配置数据库连接并创建表 283 | 在创建站点时,已经创建了数据库。先在Thinkphp的配置文件中配置数据库连接地址 284 | 修改application目录下的database.php文件 285 | 286 | 287 | ``` 288 | return [ 289 | // 数据库类型 290 | 'type' => 'mysql', 291 | // 服务器地址 292 | 'hostname' => '127.0.0.1', 293 | // 数据库名 294 | 'database' => 'demo1023_zhangq', 295 | // 用户名 296 | 'username' => 'demo1023_zhangq', 297 | // 密码 298 | 'password' => '填写真实密码', 299 | // 端口 300 | 'hostport' => '', 301 | // 连接dsn 302 | 'dsn' => '', 303 | // 数据库连接参数 304 | 'params' => [], 305 | // 数据库编码默认采用utf8 306 | 'charset' => 'utf8', 307 | // 数据库表前缀 308 | 'prefix' => '', 309 | // 数据库调试模式 310 | 'debug' => true, 311 | // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 312 | 'deploy' => 0, 313 | ``` 314 | 315 | 316 | 317 | 打开phpMyAdmin控制面板,在数据库中创建用户表。SQL语句如下: 318 | 319 | 320 | ``` 321 | DROP TABLE IF EXISTS `users`; 322 | 323 | CREATE TABLE `users` ( 324 | 325 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id编号', 326 | 327 | `user_name` varchar(155) NOT NULL COMMENT '用户名', 328 | 329 | `user_pwd` varchar(50) NOT NULL COMMENT '用户密码(MD5处理后)', 330 | 331 | PRIMARY KEY (`id`) 332 | 333 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 334 | ``` 335 | 336 | ![](/images/thinkphp/11@2x.png) 337 | 338 | ![](/images/thinkphp/12.png) 339 | 同样的操作方式添加一个用户信息,用户名admin,密码admin(密码需要MD5加密) 340 | 341 | ``` 342 | insert into users(`user_name`,`user_pwd`) value('admin','21232f297a57a5a743894a0e4a801fc3'); 343 | ``` 344 | ![](/images/thinkphp/13.png) 345 | ![](/images/thinkphp/14.png) 346 | ![](/images/thinkphp/15.png) 347 | 348 | ## 四、实现登录功能 349 | 350 | 将登录页面的表单提交地址设置为index/dologin(index模块下的dologin方法) 351 | 352 | 353 | ``` 354 |
355 | ``` 356 | 357 | 358 | 完整代码如下: 359 | 360 | 361 | ``` 362 | 363 | 364 | 365 | 登录示例 366 | 367 | 368 |

用户登录

369 | 370 | 371 | 372 | 373 | 374 |
375 | 376 | 377 | ``` 378 | 379 | 在index模块下,新建dologin方法 380 | 381 | 382 | 383 | ``` 384 | public function doLogin() 385 | { 386 | $param = input('post.'); 387 | if(empty($param['user_name'])){ 388 | $this->error('用户名不能为空'); 389 | } 390 | if(empty($param['user_pwd'])){ 391 | $this->error('密码不能为空'); 392 | } 393 | 394 | //验证用户名 395 | $has = db('users')->where('user_name',$param['user_name'])->find(); 396 | if(empty($has)){ 397 | $this->error('用户名或密码错误'); 398 | } 399 | 400 | // 验证密码 401 | if($has['user_pwd'] != md5($param['user_pwd'])){ 402 | $this->error('用户名或密码错误'); 403 | } 404 | 405 | // 记录用户登录信息 406 | cookie('user_id',$has['id'],3600); // 一个小时有效期 407 | cookie('user_name',$has['user_name'],3600); 408 | $this->redirect(url('index/index')); 409 | 410 | } 411 | ``` 412 | 413 | 414 | 415 | ## 五、引入css样式 416 | 在Thinkphp中有一些全局常亮可以直接在view中使用。在index方法的view中可以打印出常量的具体值 417 | 418 | 419 | 420 | ``` 421 | 422 | 423 | 424 | 425 | Insert title here 426 | 427 | 428 | __ROOT__
429 | __STATIC__
430 | __JS__
431 | __CSS__
432 | 433 | 434 | ``` 435 | 436 | 修改index方法 437 | 438 | ``` 439 | public function index() 440 | { 441 | $view = new View(); 442 | return $view->fetch(); 443 | } 444 | ``` 445 | 446 | 页面显示效果 447 | ![](/images/thinkphp/16.png) 448 | 因此可以将css文件文件放到/public/static/css目录下,命名为login.css,代码如下 449 | 450 | 451 | ``` 452 | html{ 453 | width: 100%; 454 | height: 100%; 455 | overflow: hidden; 456 | font-style: sans-serif; 457 | } 458 | 459 | body{ 460 | width: 100%; 461 | height: 100%; 462 | font-family: 'Open Sans',sans-serif; 463 | margin: 0; 464 | background-color: #4A374A; 465 | } 466 | 467 | #login{ 468 | position: absolute; 469 | top: 50%; 470 | left:50%; 471 | margin: -150px 0 0 -150px; 472 | width: 300px; 473 | height: 300px; 474 | } 475 | 476 | #login h1{ 477 | color: #fff; 478 | text-shadow:0 0 10px; 479 | letter-spacing: 1px; 480 | text-align: center; 481 | } 482 | 483 | h1{ 484 | font-size: 2em; 485 | margin: 0.67em 0; 486 | } 487 | 488 | input{ 489 | width: 278px; 490 | height: 18px; 491 | margin-bottom: 10px; 492 | outline: none; 493 | padding: 10px; 494 | font-size: 13px; 495 | color: #fff; 496 | text-shadow:1px 1px 1px; 497 | border-top: 1px solid #312E3D; 498 | border-left: 1px solid #312E3D; 499 | border-right: 1px solid #312E3D; 500 | border-bottom: 1px solid #56536A; 501 | border-radius: 4px; 502 | background-color: #2D2D3F; 503 | } 504 | 505 | .but{ 506 | width: 300px; 507 | min-height: 20px; 508 | display: block; 509 | background-color: #4a77d4; 510 | border: 1px solid #3762bc; 511 | color: #fff; 512 | padding: 9px 14px; 513 | font-size: 15px; 514 | line-height: normal; 515 | border-radius: 5px; 516 | margin: 0; 517 | } 518 | ``` 519 | 520 | 在login.html中加入 521 | 522 | 523 | ``` 524 | 525 | ``` 526 | 527 | 528 | 完整代码如下: 529 | 530 | ``` 531 | 532 | 533 | 534 | 535 | 登录示例 536 | 537 | 538 |
539 |

用户登录

540 |
541 | 542 | 543 | 544 |
545 |
546 | 547 | 548 | ``` 549 | 550 | 界面展示效果如下 551 | 552 | ![](/images/thinkphp/17@2x.png) 553 | 554 | ## 六、获取cookie值 555 | 556 | 在前端可以获取到cookie中的值 557 | ![](/images/thinkphp/19@2x.png) 558 | 559 | ``` 560 | 561 | 562 | 563 | 564 | Insert title here 565 | 566 | 567 | __ROOT__
568 | __STATIC__
569 | __JS__
570 | __CSS__
571 | 572 | {$Think.cookie.user_name} ,欢迎你! 573 | 574 | 575 | ``` 576 | 577 | ![](/images/thinkphp/18.png) 578 | 579 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-NonCommercial-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International 58 | Public License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-NonCommercial-ShareAlike 4.0 International Public License 63 | ("Public License"). To the extent this Public License may be 64 | interpreted as a contract, You are granted the Licensed Rights in 65 | consideration of Your acceptance of these terms and conditions, and the 66 | Licensor grants You such rights in consideration of benefits the 67 | Licensor receives from making the Licensed Material available under 68 | these terms and conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-NC-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution, NonCommercial, and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. NonCommercial means not primarily intended for or directed towards 126 | commercial advantage or monetary compensation. For purposes of 127 | this Public License, the exchange of the Licensed Material for 128 | other material subject to Copyright and Similar Rights by digital 129 | file-sharing or similar means is NonCommercial provided there is 130 | no payment of monetary compensation in connection with the 131 | exchange. 132 | 133 | l. Share means to provide material to the public by any means or 134 | process that requires permission under the Licensed Rights, such 135 | as reproduction, public display, public performance, distribution, 136 | dissemination, communication, or importation, and to make material 137 | available to the public including in ways that members of the 138 | public may access the material from a place and at a time 139 | individually chosen by them. 140 | 141 | m. Sui Generis Database Rights means rights other than copyright 142 | resulting from Directive 96/9/EC of the European Parliament and of 143 | the Council of 11 March 1996 on the legal protection of databases, 144 | as amended and/or succeeded, as well as other essentially 145 | equivalent rights anywhere in the world. 146 | 147 | n. You means the individual or entity exercising the Licensed Rights 148 | under this Public License. Your has a corresponding meaning. 149 | 150 | 151 | Section 2 -- Scope. 152 | 153 | a. License grant. 154 | 155 | 1. Subject to the terms and conditions of this Public License, 156 | the Licensor hereby grants You a worldwide, royalty-free, 157 | non-sublicensable, non-exclusive, irrevocable license to 158 | exercise the Licensed Rights in the Licensed Material to: 159 | 160 | a. reproduce and Share the Licensed Material, in whole or 161 | in part, for NonCommercial purposes only; and 162 | 163 | b. produce, reproduce, and Share Adapted Material for 164 | NonCommercial purposes only. 165 | 166 | 2. Exceptions and Limitations. For the avoidance of doubt, where 167 | Exceptions and Limitations apply to Your use, this Public 168 | License does not apply, and You do not need to comply with 169 | its terms and conditions. 170 | 171 | 3. Term. The term of this Public License is specified in Section 172 | 6(a). 173 | 174 | 4. Media and formats; technical modifications allowed. The 175 | Licensor authorizes You to exercise the Licensed Rights in 176 | all media and formats whether now known or hereafter created, 177 | and to make technical modifications necessary to do so. The 178 | Licensor waives and/or agrees not to assert any right or 179 | authority to forbid You from making technical modifications 180 | necessary to exercise the Licensed Rights, including 181 | technical modifications necessary to circumvent Effective 182 | Technological Measures. For purposes of this Public License, 183 | simply making modifications authorized by this Section 2(a) 184 | (4) never produces Adapted Material. 185 | 186 | 5. Downstream recipients. 187 | 188 | a. Offer from the Licensor -- Licensed Material. Every 189 | recipient of the Licensed Material automatically 190 | receives an offer from the Licensor to exercise the 191 | Licensed Rights under the terms and conditions of this 192 | Public License. 193 | 194 | b. Additional offer from the Licensor -- Adapted Material. 195 | Every recipient of Adapted Material from You 196 | automatically receives an offer from the Licensor to 197 | exercise the Licensed Rights in the Adapted Material 198 | under the conditions of the Adapter's License You apply. 199 | 200 | c. No downstream restrictions. You may not offer or impose 201 | any additional or different terms or conditions on, or 202 | apply any Effective Technological Measures to, the 203 | Licensed Material if doing so restricts exercise of the 204 | Licensed Rights by any recipient of the Licensed 205 | Material. 206 | 207 | 6. No endorsement. Nothing in this Public License constitutes or 208 | may be construed as permission to assert or imply that You 209 | are, or that Your use of the Licensed Material is, connected 210 | with, or sponsored, endorsed, or granted official status by, 211 | the Licensor or others designated to receive attribution as 212 | provided in Section 3(a)(1)(A)(i). 213 | 214 | b. Other rights. 215 | 216 | 1. Moral rights, such as the right of integrity, are not 217 | licensed under this Public License, nor are publicity, 218 | privacy, and/or other similar personality rights; however, to 219 | the extent possible, the Licensor waives and/or agrees not to 220 | assert any such rights held by the Licensor to the limited 221 | extent necessary to allow You to exercise the Licensed 222 | Rights, but not otherwise. 223 | 224 | 2. Patent and trademark rights are not licensed under this 225 | Public License. 226 | 227 | 3. To the extent possible, the Licensor waives any right to 228 | collect royalties from You for the exercise of the Licensed 229 | Rights, whether directly or through a collecting society 230 | under any voluntary or waivable statutory or compulsory 231 | licensing scheme. In all other cases the Licensor expressly 232 | reserves any right to collect such royalties, including when 233 | the Licensed Material is used other than for NonCommercial 234 | purposes. 235 | 236 | 237 | Section 3 -- License Conditions. 238 | 239 | Your exercise of the Licensed Rights is expressly made subject to the 240 | following conditions. 241 | 242 | a. Attribution. 243 | 244 | 1. If You Share the Licensed Material (including in modified 245 | form), You must: 246 | 247 | a. retain the following if it is supplied by the Licensor 248 | with the Licensed Material: 249 | 250 | i. identification of the creator(s) of the Licensed 251 | Material and any others designated to receive 252 | attribution, in any reasonable manner requested by 253 | the Licensor (including by pseudonym if 254 | designated); 255 | 256 | ii. a copyright notice; 257 | 258 | iii. a notice that refers to this Public License; 259 | 260 | iv. a notice that refers to the disclaimer of 261 | warranties; 262 | 263 | v. a URI or hyperlink to the Licensed Material to the 264 | extent reasonably practicable; 265 | 266 | b. indicate if You modified the Licensed Material and 267 | retain an indication of any previous modifications; and 268 | 269 | c. indicate the Licensed Material is licensed under this 270 | Public License, and include the text of, or the URI or 271 | hyperlink to, this Public License. 272 | 273 | 2. You may satisfy the conditions in Section 3(a)(1) in any 274 | reasonable manner based on the medium, means, and context in 275 | which You Share the Licensed Material. For example, it may be 276 | reasonable to satisfy the conditions by providing a URI or 277 | hyperlink to a resource that includes the required 278 | information. 279 | 3. If requested by the Licensor, You must remove any of the 280 | information required by Section 3(a)(1)(A) to the extent 281 | reasonably practicable. 282 | 283 | b. ShareAlike. 284 | 285 | In addition to the conditions in Section 3(a), if You Share 286 | Adapted Material You produce, the following conditions also apply. 287 | 288 | 1. The Adapter's License You apply must be a Creative Commons 289 | license with the same License Elements, this version or 290 | later, or a BY-NC-SA Compatible License. 291 | 292 | 2. You must include the text of, or the URI or hyperlink to, the 293 | Adapter's License You apply. You may satisfy this condition 294 | in any reasonable manner based on the medium, means, and 295 | context in which You Share Adapted Material. 296 | 297 | 3. You may not offer or impose any additional or different terms 298 | or conditions on, or apply any Effective Technological 299 | Measures to, Adapted Material that restrict exercise of the 300 | rights granted under the Adapter's License You apply. 301 | 302 | 303 | Section 4 -- Sui Generis Database Rights. 304 | 305 | Where the Licensed Rights include Sui Generis Database Rights that 306 | apply to Your use of the Licensed Material: 307 | 308 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 309 | to extract, reuse, reproduce, and Share all or a substantial 310 | portion of the contents of the database for NonCommercial purposes 311 | only; 312 | 313 | b. if You include all or a substantial portion of the database 314 | contents in a database in which You have Sui Generis Database 315 | Rights, then the database in which You have Sui Generis Database 316 | Rights (but not its individual contents) is Adapted Material, 317 | including for purposes of Section 3(b); and 318 | 319 | c. You must comply with the conditions in Section 3(a) if You Share 320 | all or a substantial portion of the contents of the database. 321 | 322 | For the avoidance of doubt, this Section 4 supplements and does not 323 | replace Your obligations under this Public License where the Licensed 324 | Rights include other Copyright and Similar Rights. 325 | 326 | 327 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 328 | 329 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 330 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 331 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 332 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 333 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 334 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 335 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 336 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 337 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 338 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 339 | 340 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 341 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 342 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 343 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 344 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 345 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 346 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 347 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 348 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 349 | 350 | c. The disclaimer of warranties and limitation of liability provided 351 | above shall be interpreted in a manner that, to the extent 352 | possible, most closely approximates an absolute disclaimer and 353 | waiver of all liability. 354 | 355 | 356 | Section 6 -- Term and Termination. 357 | 358 | a. This Public License applies for the term of the Copyright and 359 | Similar Rights licensed here. However, if You fail to comply with 360 | this Public License, then Your rights under this Public License 361 | terminate automatically. 362 | 363 | b. Where Your right to use the Licensed Material has terminated under 364 | Section 6(a), it reinstates: 365 | 366 | 1. automatically as of the date the violation is cured, provided 367 | it is cured within 30 days of Your discovery of the 368 | violation; or 369 | 370 | 2. upon express reinstatement by the Licensor. 371 | 372 | For the avoidance of doubt, this Section 6(b) does not affect any 373 | right the Licensor may have to seek remedies for Your violations 374 | of this Public License. 375 | 376 | c. For the avoidance of doubt, the Licensor may also offer the 377 | Licensed Material under separate terms or conditions or stop 378 | distributing the Licensed Material at any time; however, doing so 379 | will not terminate this Public License. 380 | 381 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 382 | License. 383 | 384 | 385 | Section 7 -- Other Terms and Conditions. 386 | 387 | a. The Licensor shall not be bound by any additional or different 388 | terms or conditions communicated by You unless expressly agreed. 389 | 390 | b. Any arrangements, understandings, or agreements regarding the 391 | Licensed Material not stated herein are separate from and 392 | independent of the terms and conditions of this Public License. 393 | 394 | 395 | Section 8 -- Interpretation. 396 | 397 | a. For the avoidance of doubt, this Public License does not, and 398 | shall not be interpreted to, reduce, limit, restrict, or impose 399 | conditions on any use of the Licensed Material that could lawfully 400 | be made without permission under this Public License. 401 | 402 | b. To the extent possible, if any provision of this Public License is 403 | deemed unenforceable, it shall be automatically reformed to the 404 | minimum extent necessary to make it enforceable. If the provision 405 | cannot be reformed, it shall be severed from this Public License 406 | without affecting the enforceability of the remaining terms and 407 | conditions. 408 | 409 | c. No term or condition of this Public License will be waived and no 410 | failure to comply consented to unless expressly agreed to by the 411 | Licensor. 412 | 413 | d. Nothing in this Public License constitutes or may be interpreted 414 | as a limitation upon, or waiver of, any privileges and immunities 415 | that apply to the Licensor or You, including from the legal 416 | processes of any jurisdiction or authority. 417 | 418 | ======================================================================= 419 | 420 | Creative Commons is not a party to its public licenses. 421 | Notwithstanding, Creative Commons may elect to apply one of its public 422 | licenses to material it publishes and in those instances will be 423 | considered the "Licensor." Except for the limited purpose of indicating 424 | that material is shared under a Creative Commons public license or as 425 | otherwise permitted by the Creative Commons policies published at 426 | creativecommons.org/policies, Creative Commons does not authorize the 427 | use of the trademark "Creative Commons" or any other trademark or logo 428 | of Creative Commons without its prior written consent including, 429 | without limitation, in connection with any unauthorized modifications 430 | to any of its public licenses or any other arrangements, 431 | understandings, or agreements concerning use of licensed material. For 432 | the avoidance of doubt, this paragraph does not form part of the public 433 | licenses. 434 | 435 | Creative Commons may be contacted at creativecommons.org. 436 | --------------------------------------------------------------------------------