我试图回应这个冗长的陈述,试着在这里查看其他答案,没有什么能解决它。
Error:
Parse error: parse error, expecting `','' or `';''
Errors parsing -
<?php
$videoEmbed = get_post_meta( get_the_id(), 'ctslider_videoembedcode', true );
$postThumb = the_post_thumbnail();
echo '<div onclick="thevid=document.getElementById('thevideo'); thevid.style.display='block'; this.style.display='none'"><img src="'.echo $postThumb.'" style="cursor:pointer" /></div><div id="thevideo" style="display:none">"'.echo $videoEmbed.'"</div>';?>
答案 0 :(得分:6)
你必须逃避你的' 所以它给出了:
echo '<div onclick="thevid=document.getElementById(\'thevideo\'); thevid.style.display=\'block\'; this.style.display=\'none\'"><img src="'.$postThumb.'" style="cursor:pointer" /></div><div id="thevideo" style="display:none">"'.$videoEmbed.'"</div>';
你不需要在第一个回声中回声
答案 1 :(得分:0)
你真的需要回应div吗? 你能不能那样做:
<div onclick="thevid=document.getElementById('thevideo'); thevid.style.display='block'; this.style.display='none'">
<img src="<?php echo $postThumb ?>" style="cursor:pointer" />
</div>
<div id="thevideo" style="display:none">
<?php echo $videoEmbed ?>
</div>
答案 2 :(得分:0)
你能试试吗,
echo '<div onclick="thevid=document.getElementById(\'thevideo\'); thevid.style.display=\'block\'; this.style.display=\'none\'">
<img src="'.$postThumb.'" style="cursor:pointer" />
</div>
<div id="thevideo" style="display:none">"'.$videoEmbed.'"</div>';
答案 3 :(得分:0)
您必须在正在键入的任何php命令周围添加<?php ?>
。试试<?php echo "whatever you want here"?>