生成数据库m3u文件

时间:2019-05-03 12:48:35

标签: php mysqli

我无法从数据库生成.m3u文件

generate.php

<?php
include_once 'conexao.php';
$myfile = fopen("arquivo.m3u", "w") or die("Impossível abrir o ficheiro!");
$mainline = 
"#EXTM3U \n"; 
fwrite($myfile, $mainline);
$grab = $link->prepare("SELECT * FROM `tb_iptv`");
$grab->execute();
foreach($grab as $p) {
$canal = $p["canal"];
$url = $p["url"];   
$tvgid = $p["tvgid"];
$tvgname = $p["tvgname"];
$tvglogo = $p["tvglogo"];
$grupo = $p["grupo"];
$mainline2 ='#EXTINF:-1 tvg-id="'.$tvgid.'" tvg-name="'.$tvgname.'" tvg-logo="'.$tvglogo.'" group-title="'.$grupo.'",'.$canal.'
'.$url.'
';
fwrite($myfile, $mainline2);    
}
fclose($myfile);
echo file_get_contents("arquivo.m3u");
header("Content-Type: audio/mpegurl");
header("Content-Disposition: attachment; filename=lista_canais.m3u");
?>
  

警告:include(conexao.php):无法打开流:没有此类文件或   第2行的C:\ wamp64 \ www \ cadastro \ generate.php中的目录警告:   include():无法打开“ conexao.php”进行包含   (include_path ='.; C:\ php \ pear')在C:\ wamp64 \ www \ cadastro \ generate.php中   在第2行

     

注意:未定义变量:链接到   第8行的C:\ wamp64 \ www \ cadastro \ generate.php致命错误:未捕获   错误:在以下位置调用成员函数prepare()的null:   第8行(!)中的C:\ wamp64 \ www \ cadastro \ generate.php错误:调用   成员函数prepare()在null中   C:\ wamp64 \ www \ cadastro \ generate.php在第8行

0 个答案:

没有答案