Preg_replace How to insert the content after the nth picture??

Source: Internet
Author: User
是这样的,我现在弄一个自动分页的功能;原理是每50张图片就插入一个分页符 
  
   ;例如:

10010

10010

我要如何才能做到每隔4个A标签就插入一个分页符:做如下效果:

10010

10010

Reply content:

是这样的,我现在弄一个自动分页的功能;原理是每50张图片就插入一个分页符 
  
   ;例如:

10010

10010

我要如何才能做到每隔4个A标签就插入一个分页符:做如下效果:

10010

10010

Give it a try.
$str = preg_replace('#((\s*){50})#sim', '\1 ', $str);

 preg_replace('#(]*>]*\ />){50}#is', '$1<\!--nextpage-->', get_post(57047)->post_content,-1,$c);

{50} can only be used on a continuous a-label, if not continuous, how to write it?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.