当前位置:网站首页>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
边栏推荐
- Building MVC system based on three-tier structure
- Microsoft planetary computer (MPC) platform introduction, registration and comparison
- 1: Mosaic of 100W basic geographic information data
- Sr-gnn shift robot gnns: overlapping the limitations of localized graph training data
- 制造业项目MDM主数据项目实施心得
- Dataworks development ODPs SQL development production environment automatic completion of ProjectName
- finkcdc支持sqlserver2008么?
- Would you like to ask whether the same multiple tasks of the PgSQL CDC account will have an impact? I now have only one of the three tasks
- Application scenarios of channel of go question bank · 11
- 智能合约安全审计入门篇 —— delegatecall (2)
猜你喜欢

华为机器学习服务语音识别功能,让应用绘“声”绘色

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

Why useevent is not good enough

Generate the last login user account report of the computer through SCCM SQL

Interpreting harmonyos application and service ecology

Introduction and download of nine npp\gpp datasets

程序员如何做自媒体?

System design idea of time traceability

论文解读(SR-GNN)《Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data》

Sentry series satellite introduction and download tutorial
随机推荐
R语言 4.1.0软件安装包和安装教程
一文理解OpenStack网络
What do I mean when I link Mysql to report this error?
Why are life science enterprises on the cloud in succession?
How to deal with the problem that the Flink CDC reads MySQL in full and always reports this error
Volcano成Spark默認batch調度器
The cdc+mysql connector joins the date and time field from the dimension table by +8:00. Could you tell me which one is hosted by Alibaba cloud
Road vector data download tutorial
Building MVC system based on three-tier structure
Real time rendering: the difference between real-time, offline, cloud rendering and hybrid rendering
Experience of MDM master data project implementation for manufacturing projects
Make track map
技术实现 | Apache Doris 冷热数据存储(一)
finkcdc支持sqlserver2008么?
Stored procedures in sqlserver
实时渲染:实时、离线、云渲染、混合渲染的区别
请问一下2.2.0版本支持动态新增mysql同步表吗
8 challenges of BSS application cloud native deployment
cdc sql表里面的datetime要用什么类型替换
ArrayList源码解析