异步PHP?

编程入门 行业动态 更新时间:2024-10-27 02:21:33
本文介绍了异步PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个 PHP 脚本,它会进行大量检查,然后将文件下载到服务器并输出原始文件.
下载我使用的文件

I have a PHP script that does a lot of checks and then downloads a file to the server and outputs the original.
To download the file I use

system("/usr/local/bin/wget -O ...");

所以 php 等待下载完成,然后输出文件.
我的问题是是否可以在某处(其他 php 文件?)发送ping"以开始下载,然后不等待结果就继续执行.

So php waits for the download to finish and then it outputs the file.
My question is if its possible to send a "ping" somewhere (other php file?) for the download to start and then without waiting for the result just continue with the execution.

推荐答案

使用 curl_multi_* 函数并行处理多个下载.PHP 缺乏任何类型的线程支持,进程分叉只是一个黑客.

Use curl_multi_* functions to handle multiple-downloads in parallel. PHP lacks any kind of threading support and process forking is merely a hack.

这篇关于异步PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 12:40:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1409327.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!