我的PHP脚本出错,“意外''aspect_ratio'T_STRING”。有人可以看看为什么会这样吗?
$text_to_be_wrapped_in_shortcode = '<div class="player player-small <?php print apply_filters( 'aspect_ratio' , 'embed-responsive embed-responsive-16by9');?>">';
echo do_shortcode( '[sociallocker id="2378"]' . $text_to_be_wrapped_in_shortcode . '[/sociallocker]' );
请帮助我,我非常感谢你们所有人。
答案 0 :(得分:0)
我认为你需要逃避你的PHP声明。
$text_to_be_wrapped_in_shortcode = '<div class="player player-small' . apply_filters( "aspect_ratio" , "embed-responsive embed-responsive-16by9") . '">';
然后
echo do_shortcode( '[sociallocker id="2378"]' . $text_to_be_wrapped_in_shortcode . '[/sociallocker]' );