当前位置:网站首页>Php OSS file read and write file, workerman Generate Temporary file and Output Browser Download
Php OSS file read and write file, workerman Generate Temporary file and Output Browser Download
2022-06-24 19:19:00 【Owenzhang24】

- fstatFonctions:Afficher toutes les informations du fichier
- Lecture du fichier: fread($fp,filesize($file_path));
- Écrire un fichier:file_put_contents($file_path,$con,FILE_APPEND);
- Application des opérations de fichiers:Peut fonctionneriniDocumentation.Écrivez la configuration du serveur àiniDans le document,Ensuite, faites - le fonctionner..
- Copier le fichier:copy("e:\2.txt","d:\1.txt")
- Créer un dossier:mkdir($path,0777,true)
//Lire le fichier header("Content-Type: text/html;charset=utf-8"); //Définir l'encodage des caractères $file = base\_path() . "/public/index.m3u8"; $read = fopen($file, 'r'); $contents = fread($read, filesize($file)); $string1 = getBeforeString($contents, 'enc.key'); $string2 = getLaterString($contents, 'enc.key'); $newContents = $string1 . 'enc.key?token=123' . $string2; fclose($read); //Écrire un fichier、 $file = base\_path() . "/public/test22.m3u8"; $handle = fopen($file, 'w'); //Ouvrir le fichier fwrite($handle, $newContents); //Écrire le contenu fclose($handle); //Fermer le fichier readfile($file); // Lire et exporter tout le contenu du fichier return redirect(WEB\_URL . '/test22.m3u8');// Page de transfert //LireOSSDocumentation $file = OSS\_URL . $url1; // Le contenu du fichier est ajouté au tableau $fileContent = @file($file); $newContent = ''; // Traverser chaque ligne du fichier foreach ($fileContent as $value) { // Ce caractère existe - t - il sur la ligne du fichier , Il y a ce remplacement if (strpos($value, 'api.qingsong.chaotuapp.com/') !== false) { $value = str\_replace('app.com/', "q.com/ckey", $value); } // Ce caractère existe - t - il sur la ligne du fichier , Il y a cette mosaïque if (strpos($value, '.ts') !== false) { $value = $ossUrl . $value; } $newContent .= $value; }//Écrire un fichier $fileName = "$token.m3u8"; // ./59ee8147cf3f42575bc91ff586d54837.m3u8 $file = "./$fileName"; //Ouvrir le fichier $handle = fopen($file, 'w'); //Écrire le contenu fwrite($handle, $newContent); //Convertir le fichier en chaîne $content = file\_get\_contents($file); //Supprimer les fichiers temporaires unlink($file); //Navigateur de sortie $response = new Response(); return $response->withHeader('content-description', 'File Transfer') ->withHeader('content-type', 'application/force-download') ->withHeader('content-disposition', "attachment; filename={$fileName}") ->withHeader('content-transfer-encoding', 'binary') ->withHeader('pragma', 'public') ->withBody($content);
Buy me a cup of coffee :)
Je pensais que ça t'aiderait.,Donne - moi une récompense,Merci beaucoup.!
Lien vers le Code d'appréciation Wechat,Cliquez pour sauter:
https://www.owenzhang.com/wechat_reward.png
边栏推荐
- 程序员大部分时间不是写代码,而是。。。
- 一文详解|Go 分布式链路追踪实现原理
- ArrayList源码解析
- 实时渲染:实时、离线、云渲染、混合渲染的区别
- 論文解讀(SR-GNN)《Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data》
- The verifiable certificate of geoscience remote sensing industry
- finkcdc支持sqlserver2008么?
- At present, only CDC monitors Mysql to get the data of new columns. Sqlserver can't, can it
- 模块五
- 请问一下2.2.0版本支持动态新增mysql同步表吗
猜你喜欢

西北工业大学遭黑客攻击?双因素认证改变局面!

「碎语杂记」这事儿不安全

Do you have all the basic embedded knowledge points that novices often ignore?

Sr-gnn shift robot gnns: overlapping the limitations of localized graph training data

技术实现 | Apache Doris 冷热数据存储(一)

一文详解|Go 分布式链路追踪实现原理

一文理解OpenStack网络

Value passing and reference passing of value types and reference types in CSharp

php OSS文件读取和写入文件,workerman生成临时文件并输出浏览器下载

Northwestern Polytechnic University attacked by hackers? Two factor authentication changes the situation!
随机推荐
【Leetcode】旋转系列(数组、矩阵、链表、函数、字符串)
FROM_ GLC introduction and data download tutorial
程序员如何做自媒体?
一文详解|Go 分布式链路追踪实现原理
flink-sql的kafka的这个设置,group-offsets,如果指定的groupid没有提
特尔携手微软发挥边云协同势能,推动AI规模化部署
Make track map
Ls common parameters
请问一下2.2.0版本支持动态新增mysql同步表吗
企业网络管理员必备的故障处理系统
cdc+mysql connector从维表中join的日期时间字段会被+8:00,请问阿里云托管的
NFT pledge liquidity mining system development technology
为什么生命科学企业都在陆续上云?
微信小程序轮播图怎么自定义光标位置
Apifox与其他接口开发工具的博弈
The sharp sword of API management -- eolink
A detailed explanation of the implementation principle of go Distributed Link Tracking
初步学习Nuxt3
Set up your own website (8)
Multi segment curve temperature control FB (SCL program) of PLC function block series