Restful 杂谈

伪静态的实现浅析

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

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

一个php程序的目录结构

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

hello.php文件数据库

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

.htaccess文件flask

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

flaskapp

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

数据库定义以下post

table user (
name varchar() primary ,
password varchar()
);

url资源定位符url

/user/<name>/

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

C <--> post
R <--> get
U <--> put
D <--> delete
相关文章
相关标签/搜索