php--正则匹配抓取html的相关内容

$str = <<<s

        <div class="article-content">
          <p><br/></p><section style="background-color: rgb(255, 255, 255); box-sizing: border-box;"><section class="Powered-by-XIUMI V5" style="position: static; box-sizing: border-box;"><section class="" style="position: static; box-sizing: border-box;"><section class="" style="box-sizing: border-box;"><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; line-height: 2em; text-indent: 2em;"><span style="font-size: 16px;">据消息,行业大咖林鵬先生、姜殿革先生两位股东现已正式加盟广东中造动力智能设备有限公司。林鵬先生出任中造动力CEO,姜殿革先生出任首席项目总监。中造动力全体同仁为家居行业智能工厂奋斗不息!</span></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; line-height: 2em; text-indent: 2em;"><span style="font-size: 16px;"><br/></span></p></section></section></section><section class="Powered-by-XIUMI V5" style="position: static; box-sizing: border-box; text-align: center;"><section class="" style="max-width: 100%; vertical-align: middle; display: inline-block; overflow: hidden !important; box-sizing: border-box;"><img src="http://img.xiumi.us/xmi/ua/wCNv/i/4ee0d1eb16c85afa3ac065d83a85e935-sz_3046064.jpg?x-oss-process=style/xm"/></section><p><br/></p></section><section class="Powered-by-XIUMI V5" style="position: static; box-sizing: border-box; text-align: center;"><section class="" style="max-width: 100%; vertical-align: middle; display: inline-block; overflow: hidden !important; box-sizing: border-box;"><img src="http://img.xiumi.us/xmi/ua/wCNv/i/a7098c8e1e408d527455508661b3c26e-sz_3944473.jpg?x-oss-process=style/xm"/></section><p><br/></p></section><section class="Powered-by-XIUMI V5" style="position: static; box-sizing: border-box; text-align: center;"><section class="" style="max-width: 100%; vertical-align: middle; display: inline-block; overflow: hidden !important; box-sizing: border-box;"><img src="http://img.xiumi.us/xmi/ua/wCNv/i/b0e11fb0e0fdbf255589ad9ab2cbe153-sz_3411415.jpg?x-oss-process=style/xm"/></section><p>▲曾总与林鵬先生合照</p><p><br/></p></section><section class="Powered-by-XIUMI V5" style="position: static; box-sizing: border-box; text-align: center;"><section class="" style="max-width: 100%; vertical-align: middle; display: inline-block; overflow: hidden !important; box-sizing: border-box;"><img src="http://img.xiumi.us/xmi/ua/wCNv/i/63960f364ce08383c3160de9b9a32725-sz_3521386.jpg?x-oss-process=style/xm"/></section><p>▲曾总与姜殿革先生合照</p><p><br/></p></section><section class="Powered-by-XIUMI V5" style="position: static; box-sizing: border-box; text-align: center;"><section class="" style="max-width: 100%; vertical-align: middle; display: inline-block; overflow: hidden !important; box-sizing: border-box;"><img src="http://img.xiumi.us/xmi/ua/wCNv/i/9900295260e61eaa3b3ac953f40d8858-sz_1514155.jpg?x-oss-process=style/xm"/></section><p><br/></p></section></section><p><br/></p><p style="text-align: center; line-height: 2em;"><span style="font-size: 16px;">中造动力联系方式</span></p><p style="text-align: center; line-height: 2em;"><span style="font-size: 16px;">固话:0757-23660927</span></p><p style="text-align: center; line-height: 2em;"><span style="font-size: 16px; text-indent: 32px; background-color: rgb(255, 255, 255);">首席项目总监姜殿革先生:18616510086</span></p><p style="text-align: center; line-height: 2em;"><span style="text-indent: 32px; background-color: rgb(255, 255, 255); font-size: 16px;">销售经理刘青松先生:18188721615</span></p><p><br/></p>
        </div>
        <div class="article-praise">
          <a href="javascript:void(0)" id="read_collection" data-id="11107"><i class="fa fa-heart-o " aria-hidden="true"></i> <span></span> </a>
          <a href="javascript:void(0)" id="read_praise" data-id="11107"><i class="fa fa-thumbs-o-up " aria-hidden="true"></i> <span>9</span> </a>
        </div>
        <div class="articles-hot-recommend">
  <div class="header-box">
    <div class="box-header">
      <h3>推荐阅读</h3>
    </div>
  </div>

  <div class="box-body">
    <ul class="articles-list">
      <li>
        <a href="/articles/11107">
        <img width="262" height="192" src="https://assets.jxcat.com/expertArticles/2018/wlceym98x.png?x-oss-process=image/resize,m_fill,w_262,h_192,color_FFFFFF" alt="Resize,m fill,w 262,h 192,color ffffff" />
        <p class="bg-text"></p>
        <p class="article-title">行业大咖加盟中造动力,群英助力企业发展</p>
</a>      </li>
      <li>
        <a href="/articles/11077">
        <img width="262" height="192" src="https://assets.jxcat.com/expertArticles/2018/3yacvkwbu.jpg?x-oss-process=image/resize,m_fill,w_262,h_192,color_FFFFFF" alt="Resize,m fill,w 262,h 192,color ffffff" />
        <p class="bg-text"></p>
        <p class="article-title">泰国、巴基斯坦、印尼、青岛家协莅临伦教参观考察,共同开展多边贸易</p>
</a>      </li>
      <li>
        <a href="/articles/11025">
        <img width="262" height="192" src="https://assets.jxcat.com/articles/2018/ljkdavgrl.jpg?x-oss-process=image/resize,m_fill,w_262,h_192,color_FFFFFF" alt="Resize,m fill,w 262,h 192,color ffffff" />
        <p class="bg-text"></p>
        <p class="article-title">家居新零售正在进行的四大探索</p>
</a>      </li>
    </ul>
  </div>
</div>

        
        <div class="product-commits article-comments" id="article_comments">
  <div class="commit-form">
    <div class="commit-title"><h3>说点什么</h3></div>
    <div class="login-form">
      <div class="form-box">
        <form data-abide="true" novalidate="novalidate" class="simple_form session" action="/login" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="authenticity_token" value="/90DGW7jSEjVwRWMzEAnrkFGqtCQl909u7Ons30WLHperZtZw6evN3Qhs1E8i5douY3xOdcKdbMrDTEhy49Vmg==" />
        <ul>
          <li><div class="form-item form-item-hr"><div class="form-label-hr"><label class="text-right middle" for="session_login"><i class="fa fa-user " aria-hidden="true"></i></label></div><div class="form-input-hr"><input required="required" aria-required="true" placeholder="用户名" type="text" name="session[login]" id="session_login" /></div><div class="checkbox-input"></div></div></li>
          <li><div class="form-item form-item-hr"><div class="form-label-hr"><label class="text-right middle" for="session_password"><i class="fa fa-unlock-alt " aria-hidden="true"></i></label></div><div class="form-input-hr"><input required="required" aria-required="true" placeholder="密码" type="password" name="session[password]" id="session_password" /></div><div class="checkbox-input"></div></div></li>
          <li class="form-action"><input type="submit" name="commit" value="登录" class="button submit-button" /></li>
        </ul>
</form>      </div>
      <div class="register-form oauth-login-section">
        <div class="oauth-login-entries">
          <a href="/oauth/wechat" data-url="/oauth/wechat" class="button gray wechat-login">
            微信登录
          </a>
          <a class="button gray submit-button" href="/register">注册</a>
        </div>
      </div>
    </div>
s;

$a = '<img class="ywxk" src="/client/images/home/ywxk.png"></img>';
$pattern = '/<img(.+?)src=[\'"](.+?)[\'"](.+?)>/ius';
preg_match_all($pattern, $str, $match);
print_r($match);die;
直接贴代码吧,(.+?)主要是用来匹配你所想要的信息
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值