详细内容看下面两位博主大神写的吧
https://www.cnblogs.com/pinard/p/9093890.html
https://blog.csdn.net/weishiym/article/details/79629329