微信掃碼登錄

来源:https://www.cnblogs.com/aitiknowledge/archive/2022/08/08/16563492.html
-Advertisement-
Play Games

微信登錄之前還需要瞭解OAuth2知識 前期準備 註冊微信開放平臺 郵箱激活 完善開發者資料(暫不支持個體用戶) 開發者資質認證:營業執照、1-2個工作如審批、300元 網站應用:最好是已經部署到伺服器上的項目,7個工作日審批 審核通過之後會有AppID和AppSecret兩個值 AppID: 申請 ...


  • 微信登錄之前還需要瞭解OAuth2知識
  • 前期準備
    • 註冊微信開放平臺
    • 郵箱激活
    • 完善開發者資料(暫不支持個體用戶)
    • 開發者資質認證:營業執照1-2個工作如審批300元
    • 網站應用:最好是已經部署到伺服器上的項目,7個工作日審批
  • 審核通過之後會有AppID和AppSecret兩個值
    • AppID: 申請的ID
    • AppSecret: 申請的Secret
  • 說明:微信登錄二維碼是以彈出層的形式打開,所以前端需要做一些引入
    • 在頁面中引入js文件:https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js
    • 在需要使用微信登錄的地方實例js對象
var obj = new WxLogin(
        {
          self_redirect: true,
          id: "放置二維碼的容器id",
          appid: "",
          scope: "",
          redirect_uri: "",
          state: "",
          style: "",
          href: ""
        }
);
  • 整個過程
    • 通過調用後端的介面,將上面js對象所需要的參數返回給前端頁面
    • 前端頁面獲取到所需要的參數即可生成二維碼
    • 用戶掃描二維碼重定向(回調)到當前後端返回的redirect_uri
    • 回調成功則微信登錄成功
  • 從這個過程中發現微信登錄過程中至少需要兩個介面
  • SpringBoot實現
    • application.properties添加微信登錄的一些配置,其中redirect_uri應該是在申請微信登錄的時候會存在一個映射關係(這裡博主也不是很懂),
      目前微信登錄支持localhost,埠應該是尚矽谷老師設定了(有可能是博主的映射關係(狗頭)),後面的映射路徑就是回調介面的映射路徑
wx.open.app_id=上面提供的AppID
wx.open.app_secret=上面提供的AppSecret
wx.open.redirect_uri=http://localhost:8160/api/user/wx/callback
web.base_url=http://localhost:3000
  • 新建常量類,讀取配置文件中微信的配置信息
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class WxConstantProperties implements InitializingBean {
    @Value("${wx.open.app_id}")
    private String appId;
    @Value("${wx.open.app_secret}")
    private String appSecret;
    @Value("${wx.open.redirect_uri}")
    private String redirectUrl;
    @Value("${web.base_url}")
    private String yyghBaseUrl;

    public static String WX_OPEN_APP_ID;
    public static String WX_OPEN_APP_SECRET;
    public static String WX_OPEN_REDIRECT_URL;
    public static String WEB_BASE_URL;

    @Override
    public void afterPropertiesSet() throws Exception {
        WX_OPEN_APP_ID = appId;
        WX_OPEN_APP_SECRET = appSecret;
        WX_OPEN_REDIRECT_URL = redirectUrl;
        WEB_BASE_URL = yyghBaseUrl;
    }
}
  • 第一個介面:返回前端生成二維碼的參數
import java.util.HashMap;

@Controller
@RequestMapping("/api/user/wx")
public class WxApiController {

    @GetMapper("/getWxParam")
    @ResponseBody
    public Result<Map<String, Object>> getParam() {
        try {
            Map<String, Object> map = new HashMap<>();
            map.put("appid", WxConstantProperties.WX_OPEN_APP_ID);
            // 固定值
            map.put("scope", "snsapi_login");
            String wxOpenRedirectUrl = WxConstantProperties.WX_OPEN_REDIRECT_URL;
            // 應微信開放平臺要求,需要使用URLEncoder規範url
            wxOpenRedirectUrl = URLEncoder.encode(wxOpenRedirectUrl, "utf-8");
            map.put("redirect_uri", wxOpenRedirectUrl);
            // 隨意值
            map.put("state", System.currentTimeMillis() + "");
            return Result.ok(map);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.fail();
        }
    }
}
  • 前端創建兩個文件
    • 請求後端介面的js文件
import request from '@/utils/request'
export default {
    getWxParam() {
        return request({
            url: `/api/user/wx/getWxParam`,
            method: 'get'
        })
    }
}
  • 當前登錄頁面的vue組件
<template></template>
<script>
<!-- 引入上面的js文件 -->
import wxApi from '@/api/wx/wxApi.js'
export default {
  data() {
    return {}
  },
  mounted() {
    // 註冊全局登錄事件對象
    window.loginEvent = new Vue();
    // (註冊)監聽登錄事件
    loginEvent.$on('loginDialogEvent', function () {
      document.getElementById("loginDialog").click();
    })
    // 觸發事件,顯示登錄層:loginEvent.$emit('loginDialogEvent')

    //初始化微信js(包好上面提及的登錄js文件)
    const script = document.createElement('script')
    script.type = 'text/javascript'
    script.src = 'https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js'
    document.body.appendChild(script)

    // 微信登錄回調處理
    let self = this;
    window["loginCallback"] = (name,token, openid) => {
      self.loginCallback(name, token, openid);
    }
  },
  methods: {
    // 第一個介面:獲取參數,生成二維碼
    wxLogin() {
      // 可以忽略的文本信息
      this.dialogAtrr.showLoginType = 'weixin'

      wxApi.getWxParam().then(response => {
        var obj = new WxLogin({
          self_redirect:true,
          id: 'weixinLogin', // 需要顯示的容器id
          appid: response.data.appid, // 公眾號appid wx*******
          scope: response.data.scope, // 網頁預設即可
          redirect_uri: response.data.redirect_uri, // 授權成功後回調的url
          state: response.data.state, // 可設置為簡單的隨機數加session用來校驗
          style: 'black', // 提供"black"、"white"可選。二維碼的樣式
          href: '' // 外部css文件url,需要https
        })
      })
    },
    // 第二個介面:重定向到某個頁面並保存cookie信息
    loginCallback(name, token, openid) {
      // 打開手機登錄層,綁定手機號,改邏輯與手機登錄一致
      if(openid != '') {
        this.userInfo.openid = openid

        this.showLogin()
      } else {
        this.setCookies(name, token)
      }
    },
    setCookies(name, token) {
      cookie.set('token', token, { domain: 'localhost' })
      cookie.set('name', name, { domain: 'localhost' })
      window.location.reload()
    },
  }
}
</script>
<style></style>
  • 在編寫第二個介面前,需要瞭解一個服務端向另一個服務端發送請求,往往是需要一個工具類
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.config.RequestConfig.Builder;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.TrustStrategy;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class HttpClientUtils {
    public static final int CONN_TIMEOUT = 10000;
    public static final int READ_TIMEOUT = 10000;
    public static final String CHARSET = "UTF-8";
    public static final String CONTENT_TYPE = "application/x-www-form-urlencoded";
    private static HttpClient client;

    static {
        PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
        cm.setMaxTotal(128);
        cm.setDefaultMaxPerRoute(128);
        client = HttpClients.custom().setConnectionManager(cm).build();
    }

    public static String postParameters(String url, String params) throws Exception {
        return post(url, params, CONTENT_TYPE, CHARSET, CONN_TIMEOUT, READ_TIMEOUT);
    }

    public static String postParameters(String url, String params, String charset, Integer connTimeout, Integer readTimeout) throws Exception {
        return post(url, params, CONTENT_TYPE, charset, connTimeout, readTimeout);
    }

    public static String postParameters(String url, Map<String, String> params) throws Exception {
        return postForm(url, params, null, CONN_TIMEOUT, READ_TIMEOUT);
    }

    public static String postParameters(String url, Map<String, String> params, Integer connTimeout, Integer readTimeout) throws Exception {
        return postForm(url, params, null, connTimeout, readTimeout);
    }

    public static String get(String url) throws Exception {
        return get(url, CHARSET, null, null);
    }

    public static String get(String url, String charset) throws Exception {
        return get(url, charset, CONN_TIMEOUT, READ_TIMEOUT);
    }

    /**
     * 發送一個get請求
     * @param url 請求地址
     * @param charset 字元集編碼
     * @param connTimeout 連接超時時間
     * @param readTimeout 響應超時時間
     * @return String
     * @throws Exception ConnectTimeoutException、SocketTimeoutException等其他異常
     */
    public static String get(String url, String charset, Integer connTimeout, Integer readTimeout) throws Exception {
        HttpClient client = null;
        HttpGet get = new HttpGet(url);
        String result = "";
        try {
            // 設置參數
            getHttpRequestBase(get, connTimeout, readTimeout);

            // 獲取響應信息
            HttpResponse res = getHttpResponse(url, get, client);

            result = IOUtils.toString(res.getEntity().getContent(), charset);
        }finally {
            get.releaseConnection();
            if (url.startsWith("https") && client instanceof CloseableHttpClient) {
                ((CloseableHttpClient) client).close();
            }
        }
        return result;
    }

    /**
     * 發送一個post請求
     * @param url 請求地址
     * @param body 請求體
     * @param mimeType 類似於Content-Type
     * @param charset 字元集編碼
     * @param connTimeout 連接超時時間
     * @param readTimeout 響應超時時間
     * @return String
     * @throws Exception ConnectTimeoutException、SocketTimeoutException等其他異常
     */
    public static String post(String url, String body, String mimeType, String charset, Integer connTimeout, Integer readTimeout) throws Exception {
        HttpClient client = null;
        HttpPost post = new HttpPost(url);
        String result = "";
        try {
            if(!StringUtils.isEmpty(body)) {
                HttpEntity entity = new StringEntity(body, ContentType.create(mimeType, charset));
                post.setEntity(entity);
            }
            // 設置參數
            getHttpRequestBase(post, connTimeout, readTimeout);

            // 獲取響應信息
            HttpResponse res = getHttpResponse(url, post, client);

            result = IOUtils.toString(res.getEntity().getContent(), charset);
        } finally {
            post.releaseConnection();
            if (url.startsWith("https") && client instanceof CloseableHttpClient) {
                ((CloseableHttpClient) client).close();
            }
        }
        return result;
    }

    /**
     * form表單提交方式請求
     * @param url 請求地址
     * @param params 表單參數
     * @param headers 請求頭
     * @param connTimeout 連接超時時間
     * @param readTimeout 響應超時時間
     * @return String
     * @throws Exception ConnectTimeoutException、SocketTimeoutException等其他異常
     */
    public static String postForm(String url, Map<String, String> params, Map<String, String> headers, Integer connTimeout, Integer readTimeout) throws Exception {
        HttpClient client = null;
        HttpPost post = new HttpPost(url);
        try {
            if (params != null && !params.isEmpty()) {
                List<NameValuePair> formParams = new ArrayList<>();
                Set<Entry<String, String>> entrySet = params.entrySet();
                for (Entry<String, String> entry : entrySet) {
                    formParams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
                }
                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);
                post.setEntity(entity);
            }
            if (headers != null && !headers.isEmpty()) {
                for (Entry<String, String> entry : headers.entrySet()) {
                    post.addHeader(entry.getKey(), entry.getValue());
                }
            }
            // 設置參數
            getHttpRequestBase(post, connTimeout, readTimeout);

            // 獲取響應信息
            HttpResponse res = getHttpResponse(url, post, client);

            return IOUtils.toString(res.getEntity().getContent(), String.valueOf(StandardCharsets.UTF_8));
        }finally {
            post.releaseConnection();
            if (url.startsWith("https") && client instanceof CloseableHttpClient) {
                ((CloseableHttpClient) client).close();
            }
        }
    }

    /**
     * 設置參數
     * @param base 協議請求對象
     * @param connTimeout 連接超時時間
     * @param readTimeout 響應超時時間
     */
    private static void getHttpRequestBase(HttpRequestBase base, Integer connTimeout, Integer readTimeout) {
        Builder customReqConf = RequestConfig.custom();
        if(connTimeout != null) customReqConf.setConnectTimeout(connTimeout);
        if(readTimeout != null) customReqConf.setSocketTimeout(readTimeout);
        base.setConfig(customReqConf.build());
    }

    /**
     * 獲取響應信息
     * @param url 請求地址
     * @param base 協議請求對象
     * @return HttpResponse
     * @throws Exception 異常信息
     */
    private static HttpResponse getHttpResponse(String url, HttpRequestBase base, HttpClient client) throws Exception{
        if (url.startsWith("https")) {
            // 執行 Https 請求.
            client = createSSLInsecureClient();
        } else {
            // 執行 Http 請求.
            client = HttpClientUtils.client;
        }
        return client.execute(base);
    }

    /**
     * 創建SSL連接供https協議請求
     * @return CloseableHttpClient
     * @throws GeneralSecurityException 安全異常
     */
    private static CloseableHttpClient createSSLInsecureClient() throws GeneralSecurityException {
        try {
            SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
                @Override
                public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
                    return true;
                }
            }).build();

            SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, new X509HostnameVerifier() {
                @Override
                public void verify(String s, SSLSocket sslSocket) throws IOException {}

                @Override
                public void verify(String s, X509Certificate x509Certificate) throws SSLException {}

                @Override
                public void verify(String s, String[] strings, String[] strings1) throws SSLException {}

                @Override
                public boolean verify(String s, SSLSession sslSession) {
                    return true;
                }
            });
            return HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build();
        } catch (GeneralSecurityException e) {
            throw e;
        }
    }

    /**
     * 從 response 里獲取 charset
     * @param response  響應信息
     */
    @SuppressWarnings("unused")
    private static String getCharsetFromResponse(HttpResponse response) {
        // Content-Type:text/html; charset=GBK
        if (response.getEntity() != null  && response.getEntity().getContentType() != null && response.getEntity().getContentType().getValue() != null) {
            String contentType = response.getEntity().getContentType().getValue();
            if (contentType.contains("charset=")) {
                return contentType.substring(contentType.indexOf("charset=") + 8);
            }
        }
        return null;
    }
}
  • 第二個介面:處理掃碼之後的介面(一般是獲取當前掃碼用戶的信息)
@Controller
@RequestMapping("/api/user/wx")
public class WxApiController {
    @GetMapping("/callback")
    public String callback(String code, String state) {
        // 根據臨時票據code和微信id及密鑰請求微信固定地址,獲取兩個值(access_token和openid)
        StringBuffer baseAccessTokenUrl = new StringBuffer()
                .append("https://api.weixin.qq.com/sns/oauth2/access_token")
                .append("?appid=%s").append("&secret=%s")
                .append("&code=%s").append("&grant_type=authorization_code");
        String accessTokenUrl = String.format(
                baseAccessTokenUrl.toString(), ConstantWxPropertiesUtils.WX_OPEN_APP_ID,
                ConstantWxPropertiesUtils.WX_OPEN_APP_SECRET, code);
        
        try {
            // 使用HttpClientUtils工具類請求地址
            String accessTokenInfo = HttpClientUtils.get(accessTokenUrl);
            JSONObject jsonObject = JSONObject.parseObject(accessTokenInfo);
            String accessToken = jsonObject.getString("access_token");
            String openid = jsonObject.getString("openid");
            // 如果資料庫表中存在openid值,
            UserInfo userInfo = userInfoService.selectWxInfoOpenId(openid);
            if(userInfo == null) {
                // 根據access_token和openid獲取掃碼人信息
                String baseUserInfoUrl = "https://api.weixin.qq.com/sns/userinfo" +
                        "?access_token=%s" + "&openid=%s";
                String userInfoUrl = String.format(baseUserInfoUrl, accessToken, openid);
                String userInfoResult = HttpClientUtils.get(userInfoUrl);
                JSONObject userObject = JSONObject.parseObject(userInfoResult);
                String nickname = userObject.getString("nickname");
                String headImageUrl = userObject.getString("headimgurl");
                
                // 信息保存到資料庫中(省略)
            }
            // 最後重定向到前端某一個頁面,期間可以隨帶一些重要的信息
            return "redirect:" + WxConstantProperties.WEB_BASE_URL + "/weixin/callback?token=" +
                    token + "&openid=" + openid + "&name=" + URLEncoder.encode(name, "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 我們在開發中,會自定義大量的組件,我們應該如何在兩個組件之間進行“值”的傳遞呢? 父子組件傳值 我們使用上一文中App.vue和HelloComp.vue組件來舉例 首先我們還是需要在APP.vue中引入HelloComp.vue <template> <div id="app"> <hello-c ...
  • 前言 前端在開發過程中若是管理系統之類的業務系統,則大多都會涉及到表格的處理,其中最為常見的就是表格的導入導出。有很多辦法都可以實現,其中最簡單的還是使用插件xlsx。 實現目標 1、對錶格數據進行增加、刪除。 2、表格數據的導出、導入。 具體邏輯 增加、刪除功能比較簡單,直接利用vue數據的響應式 ...
  • 粒子動畫,顧名思義,就是頁面上存在大量的粒子構建而成的動畫。傳統的粒子動畫主要由 Canvas、WebGL 實現。 當然,不使用 HTML + CSS 的主要原因在於,粒子動畫通常需要較多的粒子,而如果使用 HTML + CSS 的話勢必需要過多的 DOM 元素,這也就導致了使用 HTML + CS ...
  • “基於介面而非實現編程”是一條比較抽象、泛化的設計思想,其的另一個表述是“基於抽象而非實現編程”。從這條設計思想中衍生的理解就是,越抽象、越頂層、越脫離具體某一實現的設計,越能提高代碼的靈活性,越能應對未來的需求變化。 ...
  • 一、 設計思維 的概念和發展背景 設計思維是一種以用戶為中心,為產品或服務的目標用戶解決定義不明確或未知問題的思維方式。自從認知科學家和諾貝爾獎獲得者 Herbert A. Simon 在他1969年的著作《人工科學》中首次提到設計思維的概念之後,世界在不斷發展的過程中為其原理貢獻了許多想法——史蒂 ...
  • python 爬取 博客園 接 螞蟻學pythonP5生產者消費者爬蟲數據重覆問題 先看訪問地址 訪問地址是https://www.cnblogs.com/#p2 但是實際訪問地址是https://www.cnblogs.com 說明其中存在貓膩;像這種我們給定指定頁碼,按理應該是 post 請求才 ...
  • 變數用法與特征 變數綁定 let a = "hello world" 為何不用賦值而用綁定呢(其實你也可以稱之為賦值,但是綁定的含義更清晰準確)?這裡就涉及 Rust 最核心的原則——所有權,簡單來講,任何記憶體對象都是有主人的,而且一般情況下完全屬於它的主人,綁定就是把這個對象綁定給一個變數,讓這個 ...
  • 目錄 一.簡介 二.效果演示 三.源碼下載 四.猜你喜歡 零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 基礎 零基礎 OpenGL (ES) 學習路線推薦 : OpenGL (ES) 學習目錄 >> OpenGL ES 轉場 零基礎 O ...
一周排行
    -Advertisement-
    Play Games
  • 前言 在我們開發過程中基本上不可或缺的用到一些敏感機密數據,比如SQL伺服器的連接串或者是OAuth2的Secret等,這些敏感數據在代碼中是不太安全的,我們不應該在源代碼中存儲密碼和其他的敏感數據,一種推薦的方式是通過Asp.Net Core的機密管理器。 機密管理器 在 ASP.NET Core ...
  • 新改進提供的Taurus Rpc 功能,可以簡化微服務間的調用,同時可以不用再手動輸出模塊名稱,或調用路徑,包括負載均衡,這一切,由框架實現並提供了。新的Taurus Rpc 功能,將使得服務間的調用,更加輕鬆、簡約、高效。 ...
  • 順序棧的介面程式 目錄順序棧的介面程式頭文件創建順序棧入棧出棧利用棧將10進位轉16進位數驗證 頭文件 #include <stdio.h> #include <stdbool.h> #include <stdlib.h> 創建順序棧 // 指的是順序棧中的元素的數據類型,用戶可以根據需要進行修改 ...
  • 前言 整理這個官方翻譯的系列,原因是網上大部分的 tomcat 版本比較舊,此版本為 v11 最新的版本。 開源項目 從零手寫實現 tomcat minicat 別稱【嗅虎】心有猛虎,輕嗅薔薇。 系列文章 web server apache tomcat11-01-官方文檔入門介紹 web serv ...
  • C總結與剖析:關鍵字篇 -- <<C語言深度解剖>> 目錄C總結與剖析:關鍵字篇 -- <<C語言深度解剖>>程式的本質:二進位文件變數1.變數:記憶體上的某個位置開闢的空間2.變數的初始化3.為什麼要有變數4.局部變數與全局變數5.變數的大小由類型決定6.任何一個變數,記憶體賦值都是從低地址開始往高地 ...
  • 如果讓你來做一個有狀態流式應用的故障恢復,你會如何來做呢? 單機和多機會遇到什麼不同的問題? Flink Checkpoint 是做什麼用的?原理是什麼? ...
  • C++ 多級繼承 多級繼承是一種面向對象編程(OOP)特性,允許一個類從多個基類繼承屬性和方法。它使代碼更易於組織和維護,並促進代碼重用。 多級繼承的語法 在 C++ 中,使用 : 符號來指定繼承關係。多級繼承的語法如下: class DerivedClass : public BaseClass1 ...
  • 前言 什麼是SpringCloud? Spring Cloud 是一系列框架的有序集合,它利用 Spring Boot 的開發便利性簡化了分散式系統的開發,比如服務註冊、服務發現、網關、路由、鏈路追蹤等。Spring Cloud 並不是重覆造輪子,而是將市面上開發得比較好的模塊集成進去,進行封裝,從 ...
  • class_template 類模板和函數模板的定義和使用類似,我們已經進行了介紹。有時,有兩個或多個類,其功能是相同的,僅僅是數據類型不同。類模板用於實現類所需數據的類型參數化 template<class NameType, class AgeType> class Person { publi ...
  • 目錄system v IPC簡介共用記憶體需要用到的函數介面shmget函數--獲取對象IDshmat函數--獲得映射空間shmctl函數--釋放資源共用記憶體實現思路註意 system v IPC簡介 消息隊列、共用記憶體和信號量統稱為system v IPC(進程間通信機制),V是羅馬數字5,是UNI ...