In PHP, how do I extract multiple e-mail addresses from a block of text and put them into an array?

前端 未结 7 2157
时光说笑
时光说笑 2020-11-30 03:19

I have a block of text from which I want to extract the valid e-mail addresses and put them into an array. So far I have...

   $string = file_get_contents(\         


        
7条回答
  •  一向
    一向 (楼主)
    2020-11-30 03:57

    Your code is almost perfect, you just need to replace preg_match(...) with preg_match_all(...)

    http://www.php.net/manual/en/function.preg-match.php

    http://www.php.net/manual/en/function.preg-match-all.php

提交回复
热议问题