--- tags: 學習紀錄 --- # PHP websocket ### 前置作業 1. 到 https://github.com/qqqian0819/chatRoom 把專案載下來,將專案解壓縮到xampp/htdocs資料夾內 2. 到以下位置點開php.ini  3. 找到;extension=sockets的擴充指令, 然後把前面的 ";" 刪掉後儲存關閉  完成以上動作後<font color="red">重啟xampp</font> 4. 到 https://ngrok.com/ 下載ngrok ### 實際操作 1. 把xampp的 "Apache" 打開 2. 進入 http://127.0.0.1/chatRoom-master/websocket/socket.php ,到此網頁後就會打開websocket的server,這個專案的作法會一直保持連線,所以網頁一直等待載入是正常的。 3. 打開ngrok.exe 輸入 ngrok.exe http 80  4. 輸入後會得到 80port 與 443port 對外連線的網址  5. 將網址串接 /chatRoom-master/websocket/index.html 如:https://380ab7f2001c.ngrok.io/chatRoom-master/websocket/index.html 即可開始通訊。   6. 剩下的就是去了解/websocket/socket.php的程式碼在做什麼了,助教沒有去看細節再做什麼,但相信你們可以的,加油!
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.