2017-09-16 23 views
0

我提示以下错误:在我的Joomla网站: Image of the error

公告:未定义的属性:在/ home/ipmmw /的public_html stdClass的:: $内容/templates/ipmm/sppagebuilder/addons/slideshow_full/site.php上线121

if ($slide_item->content) { 
    $output .= '<p class="details ' . $slide_item->cotent_animation . '" ' . $content_data_attr . '>' . $slide_item->content . '</p>'; 
} 
+0

问题是什么? $ slide_item没有“内容”成员。 – mitch

+0

你可以用'if(isset($ slide_item-> content)){' –

回答

1

您可以检查是否存在这样一个类属性:

if(isset($slide_item->content)) { 
$output .= '<p class="details '.$slide_item->cotent_animation.'" '. 
      $content_data_attr.'>'.$slide_item->content.'</p>'; 
} 

if(property_exists($slide_item,'content')) { 
$output .= '<p class="details '.$slide_item->cotent_animation.'" '. 
      $content_data_attr.'>'.$slide_item->content.'</p>'; 
} 

参见:http://php.net/manual/en/function.property-exists.php

+0

'我认为'property_exists'对此很有用。 +1 –

相关问题