Javascript 存在时隐藏视频容器';数据库中没有要显示的视频

Javascript 存在时隐藏视频容器';数据库中没有要显示的视频,javascript,php,html,Javascript,Php,Html,下面是显示数据库中的练习视频的html代码: <video id = "video" width="640" height="360" controls = "controls" src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag. <

下面是显示数据库中的练习视频的html代码:

<video id = "video" width="640" height="360" controls = "controls" src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag. </video>
使用以下命令:

<? if ( trim($data['exercise_video']) != '' ) : ?>
<video id = "video" width="640" height="360" controls = "controls" src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag. </video>
<? endif; ?>

使用以下命令:

<? if ( trim($data['exercise_video']) != '' ) : ?>
<video id = "video" width="640" height="360" controls = "controls" src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag. </video>
<? endif; ?>

试试这个

<?php if ( $data['exercise_video'] != '' ) { ?>
<video id = "video" width="640" height="360" controls = "controls"src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag.       </video>
<?php }  ?>

试试这个

<?php if ( $data['exercise_video'] != '' ) { ?>
<video id = "video" width="640" height="360" controls = "controls"src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag.       </video>
<?php }  ?>

使用良好

<?php if (!empty($data['exercise_video']): ?>
<video id = "video" width="640" height="360" controls = "controls" src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag. </video>
<?php endif ;?>
使用

<?php if (!empty($data['exercise_video']): ?>
<video id = "video" width="640" height="360" controls = "controls" src="admin/exercise_content/<?php echo $data['exercise_video']?>" alt="Exercise" type="video/mp4"> Your browser does not support the video tag. </video>
<?php endif ;?>
使用起来更好!空($data['exercise_video']),因为如果代码不好用,它会抛出一个通知!空($data['exercise_video']),因为如果未设置,代码将抛出通知