$act=$_GET['act'];
//接收的参数
$V= newVideoinfo();
//实例化下面的类
$V->type($act);
//调用这个类后要执行的方法
classVideoinfo
//类名
{
public functiontype($act)
//类中的方法 $act
参数名
{
$db = newSQLite3('DB/VehicleDB.db');
//DB文件夹
VehicleDB.db SQLite数据库
if($act=='type') //参数不同执行的方法不同
{
$this->videotype($db);
}
else if($act=="img")
{
$this->CarouselImg($db);
}
else if($act=="videocontent")
{
$this->VideoContent($db);
}
}
//获取视频
public function VideoContent($db)
{
$sql="select *Fromt_VideoType
limit 0,6";
// $sql="select *From t_VideoType ORDER BYaddtime desc
limit0,6";
$result=$db->query($sql);
$n=0;
$strheml="";
while($row =$result->fetchArray(SQLITE3_ASSOC))
{
$sqlvideo="select *from t_VideoInfo wherevtId={$row['vtId']}";
$result1=$db->query($sqlvideo);
$n=0;
//$strheml.=count($result1)."你好";
if(!empty($result1))
{
$strheml.="
{$row['vtTypeName']}更多& lt;/h4>
";
while($row1= $result1->fetchArray(SQLITE3_ASSOC))
{
if($n==0)
{
$strheml.="";
$n++;
}
else if($n==1)
{
$strheml.="";
$n=0;
}
}
$strheml.="
{$row1['viname']}
{$row1['viTitle']}
|
{$row1['viname']}
{$row1['viTitle']}
|
";
}
}
$strheml.="
";
echo
$strheml;
}
//获取轮播图片
public function CarouselImg($db)
{
$sql="select *from t_VideoInfo ORDER BY addtimedesc
limit0,3;";
$result=$db->query($sql);
$strheml="";
while($row =$result->fetchArray(SQLITE3_ASSOC)){
$strheml.="
- ";
//?viId={$row['viId']}
}
echo $strheml;
}
//获取视频类型
public function videotype ($db)
{
$sql="select *Fromt_VideoType";
$result=$db->query($sql);
$n=0;
$strheml="";
while($row =$result->fetchArray(SQLITE3_ASSOC)){
if($n==0)
{
$strheml.="";
$n++;
}
else if($n==3)
{
$strheml.="";
$n=0;
}
else{
$n++;
$strheml.="";
}
}
echo $strheml;
}
}