这段代码:
$_post = &get_post($post->ID);
$classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment';
有时会产生此错误:
[Sun Apr 15 08:51:35 2012] [error] [client 180.76.5.150] PHP Notice: Undefined property: stdClass::$iconsize in /srv/www/virtual/myblog.com/htdocs/wp-content/themes/mimbo/attachment.php on line 8
我想修改该行以添加 property_exists 检查属性并默认为 '' 如果它不存在但对处理属性的语法有点不熟悉。这条线看起来如何?