分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

php 执行耗时任务 后台执行

发布时间:2023-09-06 02:16责任编辑:熊小新关键词:暂无标签
// 你要跳转的url$url = "http://www.baidu.com/"; // 如果使用的是php-fpmif(function_exists(‘fastcgi_finish_request‘)){ ???header("Location: $url"); ???ob_flush(); ???flush(); ???fastcgi_finish_request();// Apache ?}else{ ???header( ‘Content-type: text/html; charset=utf-8‘ ); ???if(function_exists(‘apache_setenv‘))apache_setenv(‘no-gzip‘, ‘1‘); ???ini_set(‘zlib.output_compression‘, 0); ???ini_set(‘implicit_flush‘, 1); ???echo "<script>location=‘$url‘</script>"; ???ob_flush(); ???flush();} ????// 这里是模拟你的耗时逻辑 ???sleep(33);

linux测试成功,windows不行

可处理的扩展 Gearman yii2-queue exec命令等 待研究

php 执行耗时任务 后台执行

原文地址:https://www.cnblogs.com/jimz/p/9707001.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved