利用express做留言板練習

2021-10-05 18:37:27 字數 1164 閱讀 2945

var express=

require

('express');

express()

;var json=[,

,,,]

;use

('/node_modules'

,express.

static

('./node_modules/'))

;engine

('html'

,require

('express-art-template'))

;//模板字尾名是啥型別檔案 請求模板

get(

"/",

function

(req,res))}

)get

("/post"

,function

(req,res)

)var bodyparser =

require

('body-parser');

use(bodyparser.

urlencoded()

);use(bodyparser.

json()

);post

('/post'

,function

(req,res)

)listen

(3000

,function()

)//所以模板都要放在views資料夾裡

="list-group"

>

}="list-group-item"

>}:}

="pull-right"

>

}<

/span>

<

/li>

}

="header container"

>

="page-header"

>

"/">首頁<

/a>

/small>

<

/h1>

<

/div>

<

/div>

="comments container"

>

PHP 留言板練習

登入頁面同session一樣 login頁面 loginchuli頁面 session start uid post uid pwd post pwd include dbda.php db new dbda sql select count from yuangong where username...

0526留言板練習

登入頁面 使用者名稱 口 令 登入處理頁面 session start yhm post yhm mm post kl include dbda.php db new dbda sql select count from yuangong where username and password j ...

留言板骨架

顯示頁 form action lyb index.php index insert.html method post input name text type text value 表單提交 action位址要換成thinkphp裡的u方法,也就是去控制器裡找方法,這個方法負責接收post來的資料...