2013-11-28 55 views
-3

我有這樣一段代碼,它工作正常,但我的一個客戶所得到的致命錯誤:無法使用字符串作爲上線陣列偏移151

Fatal error: Cannot use string offset as an array

我評論說,產生錯誤的行。

       <?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

請張貼get_field功能。 – cguedel

+0

這是一個重複問題:http://stackoverflow.com/questions/3059927/fatal-error-cannot-use-string-offset-as-an-array –

回答

0
<?php 

if(is_array($thumbId1)){ 

$portfolio_large = $thumbId1[0]['image']; 

} 

?> 
相關問題