array (
  'meta_Title' => '页面标题',
  'meta_Description' => '摘要',
  'meta_Keywords' => '',
  'intro' => '<p><img width="147" height="187" alt="" src="/uploadfile/1112/2011060818415046854.jpg" /><img alt="" src="/uploadfile/1112/2011060818415046854(1).jpg" /><img alt="" src="/uploadfile/1112/2011060818415046854(2).jpg" /><img width="0" height="0" alt="" src="/uploadfile/1112/2011060818415046854(3).jpg" /><img width="0" height="0" alt="" src="/uploadfile/1112/2011060818525452928.jpg" /></p>',
  'photo_narrate' => '',
  'photo' => '1/11_1324179006.jpg',
)mysql数据库里面保存信息是上面的形式,如何在smarty里面把图片地址提取出来

解决方案 »

  1.   

    <?php
    $arr = array (
      'meta_Title' => '页面标题',
      'meta_Description' => '摘要',
      'meta_Keywords' => '',
      'intro' => '<p><img width="147" height="187" alt="" src="/uploadfile/1112/2011060818415046854.jpg" /><img alt="" src="/uploadfile/1112/2011060818415046854(1).jpg" /><img alt="" src="/uploadfile/1112/2011060818415046854(2).jpg" /><img width="0" height="0" alt="" src="/uploadfile/1112/2011060818415046854(3).jpg" /><img width="0" height="0" alt="" src="/uploadfile/1112/2011060818525452928.jpg" /></p>',
      'photo_narrate' => '',
      'photo' => '1/11_1324179006.jpg',
    );
     
    preg_match_all("/src=\".+?\"/",$arr['intro'],$match);$arr['imgSrc'] = $match[0];