
golang
韩寅嵩
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Golang协程 与 PHP协程的概念
协程的目的是充分利用cpu处理程序,当有io操作时会挂起,io等待时间完全忽略,已达到程序并发; php协程概念: 目前已知php可以实现协程的方法是使用swoole扩展; 模拟业务场景,比如我们要抓取豆瓣电影top250; go(){ $http = new http(); (请求class) while(ture){ $result = $http->ge...原创 2019-06-20 19:38:35 · 870 阅读 · 0 评论 -
golang协程实战之抓取豆瓣电影top数据
package main import ( "fmt" "io/ioutil" "net/http" "os" "regexp" "runtime" "strconv" "time" ) //定义新的数据类型 (结构体) type Spider struct { url string header map[...原创 2019-06-20 19:57:18 · 663 阅读 · 0 评论