我有这段代码,工作正常,但我的一个客户正在获取
致命错误:不能将字符串偏移用作数组
我评论了生成错误的行。
<?php
$thumbId1 = get_field('portfolio_images'); //this is the line that generates the error
$portfolio_large = $thumbId1[0]['image'];
$mafioso_smvideo = get_field('small_video',$post->ID);
if($mafioso_smvideo!='') {
echo do_shortcode($mafioso_smvideo);
}
elseif (!$portfolio_large == ''){
?>
<?php
echo '<img src="'.aq_resize( $portfolio_large, 340, 197, true ).'" alt="'.get_the_title().'" class="categ-thumb"/>';
?>
答案 0 :(得分:0)
<?php
if(is_array($thumbId1)){
$portfolio_large = $thumbId1[0]['image'];
}
?>