惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Register - Security
The Register - Security
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
量子位
C
Check Point Blog
博客园 - 【当耐特】
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
The Last Watchdog
The Last Watchdog
博客园 - Franky
N
Netflix TechBlog - Medium
Webroot Blog
Webroot Blog
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
D
Docker
S
Security Affairs
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
V2EX - 技术
V2EX - 技术
Jina AI
Jina AI
Help Net Security
Help Net Security
L
LangChain Blog
P
Proofpoint News Feed
The Cloudflare Blog
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
Schneier on Security
Schneier on Security
Recent Announcements
Recent Announcements
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
V
Vulnerabilities – Threatpost
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
P
Proofpoint News Feed
O
OpenAI News
H
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic

博客园 - 尘梦

calude code 2.188 根据cli.map还原 centos6 安装gcc 多版本 自定义编译bulma 神通mysql模式转 mysql ai数学书籍 chromedriver 网络安全渗透测试写法 编译php需要的扩展 python 合并同列数据 组合 新的excel vue table 表格记录选中 linux wktohtmlpdf 结合/tmp路径 无法创建问题 c语言开发 php扩展 sm4 macos php 如何链接神通数据库aci layui table tr a标签倒计时 操作 刷新以后继续倒计时 使用c# 开发 php的com组件 世界级地图数据处理 及 联动效果 python 部署chatglm2b macos 下连接php 人大金仓pdo_kdb问题 php curl 多次发送
php 结合pcntl_fork导出excel数据 使用
尘梦 · 2023-10-26 · via 博客园 - 尘梦
// 任务列表

  $userInfo = $this->user->getUserInfo(0, 50000);
  // 存储子进程的PID
  $childPids = [];

  for ($i = 1; $i <= 20; $i++) {
   $pid = pcntl_fork();

   if ($pid == -1) {
    die("无法创建子进程");
   } elseif ($pid == 0) {
    $is = ($i - 1) * 1000;
    $test = array_slice($userInfo, $is, 1000);

    foreach ($test as $key => $vals) {
     $childPids[] = array(
      'name' => decryptInfo($vals['name']),
      'hash' => $this->pub->decrypt($vals['hash'], $keypws),
      'dzyj' => decryptInfo($vals['dzyj']),
      'sj' => decryptInfo($vals['sj'])
     );
    }
    file_put_contents(APPPATH . 'data/test.json', json_encode($childPids), FILE_APPEND);
    exit(); // 子进程执行完毕后退出
   }
  }

  // 父进程等待所有子进程完成
  while (pcntl_waitpid(0, $status) != -1) {
   $status = pcntl_wexitstatus($status);
   echo "子进程 {$status} 已完成\n";
  }
``