Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
01 - W3 intro - OpenWebSchool
Search
openwebschool
August 12, 2012
Programming
3
250
01 - W3 intro - OpenWebSchool
openwebschool
August 12, 2012
Tweet
Share
More Decks by openwebschool
See All by openwebschool
11 - CodeIgniter - OpenWebSchool
openwebschool
1
350
09 - Node.JS - OpenWebSchool
openwebschool
1
390
07 - Javascript - OpenWebSchool
openwebschool
3
340
08 - js frontend & jQuery - OpenWebSchool
openwebschool
3
280
05 - MySQL - OpenWebSchool
openwebschool
1
250
06 - PHP & MySQL - OpenWebSchool
openwebschool
1
280
03 - PHP II - OpenWebSchool
openwebschool
2
390
04 - CSS - OpenWebSchool
openwebschool
4
360
02 - PHP I - OpenWebSchool
openwebschool
3
270
Other Decks in Programming
See All in Programming
AIと協働し、イベントソーシングとアクターモデルで作る後悔しないアーキテクチャ Regret-Free Architecture with AI, Event Sourcing, and Actors
tomohisa
2
950
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
160
Kotlinで実装するCPU/GPU 「協調的」パフォーマンス管理
matuyuhi
0
410
Amazon Bedrock Knowledge Bases Hands-on
konny0311
0
150
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
1.6k
PyCon mini 東海 2025「個人ではじめるマルチAIエージェント入門 〜LangChain × LangGraphでアイデアを形にするステップ〜」
komofr
3
1k
PHPライセンス変更の議論を通じて学ぶOSSライセンスの基礎
matsuo_atsushi
0
150
Flutterチームから作る組織の越境文化
findy_eventslides
0
110
Dive into Triton Internals
appleparan
0
490
しっかり学ぶ java.lang.*
nagise
1
380
Tangible Code
chobishiba
3
570
スタートアップを支える技術戦略と組織づくり
pospome
4
1.5k
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
For a Future-Friendly Web
brad_frost
180
10k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Building Applications with DynamoDB
mza
96
6.8k
Code Review Best Practice
trishagee
72
19k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
Transcript
WWW Intro Ensky / 林宏昱
None
None
None
Client – Server 1. 商店開著等顧客進來 2. 顧客隨時想來就來 3. 越大的店可以容納越多的顧客
Client – Server • 我們的網路世界也是一樣 • 有一些商店( Server ) •
使用者是顧客( Client ) • 我想上某個網站的時候就連過去, Server 永遠開著
Hostname and IP • IP is an Unique identifier –
就像身分証一樣 • 網路有自己的機制,可以讓你輸入 IP 就找到 那台機器。 • http://140.113.41.8 – 但這不 make sense • http://www.nctu.edu.tw – It’s great!
Uniform Resource Identifier http://comic.ensky.tw/register ftp://ca.nctu.edu.tw Protocol (like FTP, HTTP, Telnet…)
Host( Domain Name / IP ) Path URI = Protocol :// Host + Path
Uniform Resource Identifier • 絕對連結 • 所有網路資源都可以用一個絕對連結來代 表。 • ftp://ca.nctu.edu.tw
• telnet://bs2.to • ssh://bsd6.cs.nctu.edu.tw
Links • In http://ensky.tw/test/test1/index.html • A.txt -> http://ensky.tw/test/test1/A.txt • ../A.txt
-> http://ensky.tw/test/A.txt • ../b/A.txt -> http://ensky.tw/test/b/A.txt • ../../b/A.txt -> http://ensky.tw/b/A.txt • /A.txt -> http://ensky.tw/A.txt
HTTP Basic(餐廳) • 1. 說中文 • 2. 清楚描述我要吃啥 • 這就是協定
(protocol) : 我和店家的協定
HTTP Request 我要 /index.php 好喔,給你
HTTP Request Overview • http://comic.ensky.tw/register 1. 連到 140.113.27.33:80 // 就是
comic.ensky.tw 這個 hostname 轉換成的 IP 2. 丟下面的文字 GET /register HTTP/1.1 Host: comic.ensky.tw ...
HTTP Request Method GET /register HTTP/1.1 Host: comic.ensky.tw OR GET
http://comic.ensky.tw/register HTTP/1.1 Method URI Protocol_version Key: value
HTTP Request Method • GET http://comic.ensky.tw/register HTTP/1.1 • GET –
Read, 讀取資料 • POST – Create, 新增資料 • PUT – Update, 修改資料 • DELETE – Delete, 刪除資料
HTTP Request Feature Host: comic.ensky.tw Cookie: xx=yy; aa=bb; … Referer:
http://comic.ensky.tw/ User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.60 Safari/537.1
HTTP Response 我要 index.php 好喔,給你
HTTP Response Overview HTTP/1.1 200 OK Set-Cookie: a=b; c=d; …
Content-Type: text/html; charset=utf-8 Content-Encoding: gzip 文件內容 (html) Protocol Code Response_text Key: value
Take a Break
HTML
HTML • HTML 規範了有什麼東西要被顯示在網頁上 • 是一個 Markup Language < 段落
> 這是一篇文章 </ 段落 > < 圖片 網址 =“http://this.is.a.pic/pic.jpg”>
HTML < 標籤名稱 屬性 1=“ 值 ” 屬性 2=“ 值
2”> 子元素 </ 標籤名稱 > <p> 這是一個真的段落 </p>
HTML 呈現的是「文件」 嚴格來說, HTML 不算是一種「程式語言」
HTML Tags <!doctype html> <html> <head> <meta charset=“utf-8”> <title> 這是網頁的標題
</title> </head> <body> <p> 這是一個段落文字 </p> </body> </html>
HTML Tags • <head> 裡面放的是「關於這個網頁的資訊」 – 編碼 – 網頁標題 •
<body> 放的是「這個網頁的內容」 也就是所有顯示出來的東西
HTML Tags • 其他 Tag 請自己看 • 請務必要搞懂最基本的那些 tags •
比方說 a, img, table, form, textarea, select, br, p, div, span, pre, style, link, script, …
HTML Attributes 每個元素會有不同的屬性可以設定 <img width=“123” height=“456” src=“…”> 以下四個屬性是每個元素都有的 • class
- 元素的類別 • id - 元素的唯一名稱 • style - 元素的樣式 • title - 元素的標題文字
HTML Entities 還記得 C 語言中,你為什麼不能宣告 int for = 1; 嗎?
因為 for 是 C 語言中的保留字 同樣的, HTML 中也有所謂的「保留字」 比如說「 < 」這個符號就是
HTML Entities 還記得這行是什麼意思嗎? <body> <p> 這是一個段落文字 </p> </body> 仔細看之後你會發現,在 <p>
之前有好多空白 ( 或者是 tab) 但網頁上卻不會真的顯示出那些空白
HTML Entities 那如果我要打「 < 」或者是空白,怎麼辦? 常見的保留字: < < >
> & & © © ® ® ™ ™
Encodings 很久很久以前,老美發明了電腦 那時的電腦還沒有網路 老美自己當然只用 ABCDEFG 所以他們發明了 ASCII code 的表示方法
Encodings 但是用中文的我們可不能只用 ASCII 去表示中華博大精深的文字 1 個 byte 完全就是不夠用阿 所以我們自己創了 Big5
這套編碼方式 用兩個 byte 來表示中文
Encodings 那時候網路可還沒有普及呢 大家用 big5 用爽爽,反正只有我們會用 所以沒差 但網路一普及就崩潰了阿 每個國家都有一套自己的編碼方法 我們有 big5
中國有 GB2312 日本有 JIS
Encodings 於是有人就提出一套編碼完全攻略 叫做 unicode 用 4 個 bytes 把全部的字都塞進去 於是普天同慶
全世界的電腦都可以正確顯示中文網站 了!
Encodings 而 UTF-8 是 Unicode 的一種實作方法 詳細資訊請參考 wiki ,在此不多做說明 於是乎,我們寫網頁的都要記得
你寫好的網頁要存成 UTF-8 HTML 裡面也要註明編碼是 UTF-8 不然瀏覽器會搞錯
Encodings • Nodepad++ 中編成 UTF-8 的方法 • 記事本中編成 UTF-8 的方法
URL Encoding 網址有一套規範,叫做 RFC 1738 裡面規定 URL 只能是 ASCII 的某些文字組成
因此若是你想在 HTTP Request 中使用中文 (比如說你想做一個抓漫畫機器人之類的) 需要作 URL Encoding google : URL Encoding
Homework • 搞懂 HTML 基本元素的用途、實際操作看看 ref: http://goo.gl/QVoic • 搞懂這份投影片介紹過的東西 ref:
http://www.google.com.tw • 練習 1 :自我介紹