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

推荐订阅源

T
Tor Project blog
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Jina AI
Jina AI
雷峰网
雷峰网
博客园_首页
博客园 - 三生石上(FineUI控件)
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Forbes - Security
Forbes - Security
T
Threatpost
V
Visual Studio Blog
A
Arctic Wolf
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Spread Privacy
Spread Privacy
N
News and Events Feed by Topic
Vercel News
Vercel News
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
NISL@THU
NISL@THU
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
PCI Perspectives
PCI Perspectives
博客园 - 【当耐特】
IT之家
IT之家
S
Secure Thoughts
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
Cisco Talos Blog
Cisco Talos Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
月光博客
月光博客
Latest news
Latest news
小众软件
小众软件
Attack and Defense Labs
Attack and Defense Labs
I
Intezer
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
大猫的无限游戏
大猫的无限游戏

博客园 - 尘梦

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";
  }
``