所以我一直试图在php请求中制作一个播放YouTube链接的页面
我用过php,并且用过
<?php
$VID = $_GET['vid'];
echo $VID;
$file = fopen("Vid.txt","w");
fwrite($file,$VID);
?>
发出$ _get请求以获取YouTube ID并将其写入.txt文件
然后我做了一个页面来读取文件,并在嵌入的YouTube链接上使用它
<?php
$file = fopen ("Vid.txt","r");
$id = fread($file,filesize("Vid.txt"));
fclose($file);
echo $id;
echo '<iframe width="560" height="315" src="https://www.youtube.com/embed/' . $id . '?autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
?>
我想知道的是当.txt更改时如何自动重新加载页面
P.S:我对php,html和javascript非常了解
预先感谢