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

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
IT之家
IT之家
腾讯CDC
博客园 - 【当耐特】
博客园 - 聂微东
月光博客
月光博客
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
博客园 - 叶小钗
S
Security @ Cisco Blogs
雷峰网
雷峰网
N
News and Events Feed by Topic
Attack and Defense Labs
Attack and Defense Labs
Forbes - Security
Forbes - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
SegmentFault 最新的问题
NISL@THU
NISL@THU
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
Lohrmann on Cybersecurity
Project Zero
Project Zero
www.infosecurity-magazine.com
www.infosecurity-magazine.com
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
The Last Watchdog
The Last Watchdog
Apple Machine Learning Research
Apple Machine Learning Research
W
WeLiveSecurity
C
Cisco Blogs
T
Tenable Blog
Schneier on Security
Schneier on Security
爱范儿
爱范儿
美团技术团队
V2EX - 技术
V2EX - 技术
V
V2EX
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
Security Archives - TechRepublic
Security Archives - TechRepublic
The Hacker News
The Hacker News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
博客园_首页
H
Hacker News: Front Page
量子位
N
News | PayPal Newsroom
大猫的无限游戏
大猫的无限游戏

博客园 - 尘梦

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