在 PHP 中将提取的 mp4 链接导出到新的 txt 文件

Exporting extracted mp4 links to a new txt file in PHP

提问人:Jack Bender 提问时间:6/4/2023 最后编辑:Jack Bender 更新时间:6/4/2023 访问量:152

问:

我有这个php代码,它从名为SSIPTVx.txt的txt文件中提取特定的mp4链接。

我的问题是:我如何将获得的结果导出到新的 txt 文件?

<?php
// Open txt file
$file = fopen("SSIPTVx.txt", "r");

// Read the content line by line
while(!feof($file)) {
  $line = fgets($file);


// Find specific .mp4 links
  preg_match_all('/(https?:\/\/(tream720\.xyz\/content\/|nvid101\.cdnii\.com\/|video\.videodomain\.icu\/)[^\s]+\.mp4)/', $line, $matches);

// Print found links
  foreach($matches[0] as $match) {
    echo $match . "<br>";
  }

}

// Close txt file
fclose($file);

?>

我尝试为新的 txt 文件放置 fopen,但无法获得任何结果

PHP 文件 超链接 MP4 fopen

评论

0赞 com.on.ist 6/4/2023
我认为这是你应该这样做的方式->stackoverflow.com/a/37780448/9739794 你不能用 fopen() 同时打开多个文件。
0赞 bobble bubble 6/4/2023
如果文件不是很大,也许使用 & ,类似于 tio.run 上的这个演示file_get_contentsfile_put_contents

答: 暂无答案