五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

2023.4.4的課程講義

2023-04-04 09:12 作者:燒串者  | 我要投稿

url怎么用
url是什么

url.parse----解析url



var url=require('url')
url.parse("網(wǎng)址")

網(wǎng)址:http://www.baidu.com
? ?var url=require('url')
? ?url.parse("http://www.baidu.com?name=good")
? ?url.parse("http://www.baidu.com?name=good",true)
--------------------------------------------
const url=require('url');
var api="http://www.baidu.com?name=nice&age=18";
console.log(url.parse(api));
// ?query: 'name=nice&age=18'
--------------------------------------------
//
const url=require('url');
var api="http://www.baidu.com?name=nice&age=18";
console.log(url.parse(api,true));
// query: [Object: null prototype] { name: 'nice', age: '18' },
//轉(zhuǎn)換成了對象!
-------------------------------------------
? ?//
學(xué)習(xí)這個:!
var getValue=url.parse(api,true).query;
console.log(getValue);


怎么寫:
const url=require('url');
var api="http://www.baidu.com?name=nice&age=18";
var getValue=url.parse(api,true).query;
console.log(getValue);
-------------------------------------------
//模板字符串
const url=require('url');
var api="http://www.baidu.com?name=nice&age=18";
var getValue=url.parse(api,true).query;
console.log(getValue);
console.log(`姓名:${getValue.name}---年齡:${getValue.age}`);



------------------------------------------
? ?作者:燒串者 https://www.bilibili.com/read/cv22828244?spm_id_from=333.999.0.0 出處:bilibili
const http=require('http');
http.createServer((req,res)=>{
? ? ? ?console.log(req.url);
? ? ? ?res.writeHead(200,{"Content-type":"text/html;charset='utf-8'"}); //解決亂碼

? ? ? ?res.write("<head> <meta charset='UTF-8'></head>"); ?//解決亂碼

? ? ? ?(?)

? ? ? ?res.end("中華民族偉大復(fù)興");
? ?}
).listen(3001);

console.log("server running at localhost:3001");




[-----------------------
? ?http://www.baidu.com?name=nice&age=18

? -------> 127.0.0.1?name=nice&age=18

? ?------------------------]

console.log(req.url);---->127.0.0.1?name=nice&age=18

----------------------------------------
const url=require('url');
if(req.url=='/favicon.ico'){
? ?var userinfo=url.parse(req.url,true).query;
? ?console.log(`姓名:${getValue.name}---年齡:${getValue.age}`);
}
------------------------------------------------------
const http=require('http');
const url=require('url');
http.createServer((req,res)=>{
? ? ? ?console.log(req.url);
? ? ? ?res.writeHead(200,{"Content-type":"text/html;charset='utf-8'"}); //解決亂碼

? ? ? ?res.write("<head> <meta charset='UTF-8'></head>"); ?//解決亂碼


? ? ? ?if(req.url!=='/favicon.ico'){
? ? ? ? ? ?var userinfo=url.parse(req.url,true).query;
? ? ? ? ? ?console.log(`姓名:${userinfo.name}---年齡:${userinfo.age}`);
? ? ? ?}

? ? ? ?res.end("中華民族偉大復(fù)興");
? ?}
).listen(3001);

console.log("server running at localhost:3001");

2023.4.4的課程講義的評論 (共 條)

分享到微博請遵守國家法律
乐陵市| 高碑店市| 仁布县| 东城区| 陇川县| 全州县| 田阳县| 定陶县| 周宁县| 大方县| 溧阳市| 邵武市| 上思县| 乌兰察布市| 天水市| 罗城| 南汇区| 庆元县| 平阴县| 清镇市| 沽源县| 新河县| 大宁县| 安岳县| 普宁市| 鹰潭市| 建昌县| 来凤县| 麻江县| 新密市| 庄浪县| 宿松县| 太原市| 洱源县| 星子县| 白沙| 遵化市| 正宁县| 莱芜市| 宜君县| 岳西县|