有没有办法通过数据库中嵌入的 url 在我的网站上显示 vimeo 视频?
Is there a way to display vimeo videos on my website from embedded url in database?
我正在尝试创建人们可以输入视频的地方 url,它会保存到我的数据库中。问题是,在我将视频 url 保存到我的数据库后,如何使用 PHP 在页面上显示它?
例如,使用这个嵌入的 vimeo 视频,我从我的数据库中调用它后如何显示它。
如果我想从数据库中这样显示出来:
$result = mysqli_query($connect,"SELECT * FROM web where video <> '' && video IS NOT NULL");
if ($row = mysqli_fetch_array($result))
{
如何显示?
<iframe src="https://player.vimeo.com/video/90312869" width="500" height="281"
frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
</iframe>
<p><a href="https://vimeo.com/90312869">360°
Video using 6 GoPro Cameras - spherical panorama timelapse</a>
from <a href="https://vimeo.com/j0n4s">j0n4s</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
像这样:
$result = mysqli_query($connect,"SELECT * FROM web where video <> '' && video IS NOT NULL");
if ($row = mysqli_fetch_array($result))
{
$url = $row['url'];
}
<iframe src="<?php echo $url; ?>" width="500" height="281"
frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="<?php echo $url; ?>">360°
Video using 6 GoPro Cameras - spherical panorama timelapse</a>
from <a href="https://vimeo.com/j0n4s">j0n4s</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
in html 5 我会这样写
<?php
// get the url
$sourceURL = value of the extracted column from your table which is a url;
//Extract the file name
$fileName = new SplFileInfo::getFilename ( $sourceURL );
// Get the file extention
$fileExtention = new SplFileInfo::getExtension ( $fileName );
$sourceHTML = '<source src='.$sourceURL.' type="video/'.$fileExtention.'">';
?>
<video width="400" controls>
<?php echo $sourceHTML; ?>
Your browser does not support HTML5 video.
</video>
我正在尝试创建人们可以输入视频的地方 url,它会保存到我的数据库中。问题是,在我将视频 url 保存到我的数据库后,如何使用 PHP 在页面上显示它?
例如,使用这个嵌入的 vimeo 视频,我从我的数据库中调用它后如何显示它。
如果我想从数据库中这样显示出来:
$result = mysqli_query($connect,"SELECT * FROM web where video <> '' && video IS NOT NULL");
if ($row = mysqli_fetch_array($result))
{
如何显示?
<iframe src="https://player.vimeo.com/video/90312869" width="500" height="281"
frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
</iframe>
<p><a href="https://vimeo.com/90312869">360°
Video using 6 GoPro Cameras - spherical panorama timelapse</a>
from <a href="https://vimeo.com/j0n4s">j0n4s</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
像这样:
$result = mysqli_query($connect,"SELECT * FROM web where video <> '' && video IS NOT NULL");
if ($row = mysqli_fetch_array($result))
{
$url = $row['url'];
}
<iframe src="<?php echo $url; ?>" width="500" height="281"
frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="<?php echo $url; ?>">360°
Video using 6 GoPro Cameras - spherical panorama timelapse</a>
from <a href="https://vimeo.com/j0n4s">j0n4s</a> on <a href="https://vimeo.com">Vimeo</a>.</p>
in html 5 我会这样写
<?php
// get the url
$sourceURL = value of the extracted column from your table which is a url;
//Extract the file name
$fileName = new SplFileInfo::getFilename ( $sourceURL );
// Get the file extention
$fileExtention = new SplFileInfo::getExtension ( $fileName );
$sourceHTML = '<source src='.$sourceURL.' type="video/'.$fileExtention.'">';
?>
<video width="400" controls>
<?php echo $sourceHTML; ?>
Your browser does not support HTML5 video.
</video>