Restful 杂谈

发布时间:2019-08-07 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Restful 杂谈脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

伪静态的实现浅析

如下程序实现从
/hello/bowmanhan/

/hello.php?user=ddddddd
的url映射,即php里常讲的伪静态

一个php程序的目录结构

D:htdocs/
├─phpapp1├─ hello.php
├        ├─ .htaccess

hello.php文件

#filename:hello.php 
hello<?php echo $_GET[‘name’]; ?>

.htaccess文件

#filename:.htaccess
RewriteEngine on
rewriterule ^www.example.COM/hello/([^.]+) http://www.example.com/hello.php?user=$1

flask

view.py
@url('/hello/<user>')
def hello(user)return 'hello'+user

数据库定义如下

table user (
name vArchar() Primary ,
password VARchar()
);

url资定位符

/user/<name>/

什么是CRUD
CRUD 是 Create Read Update Delete 的缩写,即我们中文所说的数据库的增删查改
CRUD分别对应http协议的四种方法,

C <--> post
R <--> get
U <--> put
D <--> delete

脚本宝典总结

以上是脚本宝典为你收集整理的Restful 杂谈全部内容,希望文章能够帮你解决Restful 杂谈所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。