dongluo1853 2011-02-04 04:00
浏览 35
已采纳

从用户输入中获取电子邮件ID

i have a form where user can either input email ids like

someone@somewhere.com,anyone@anywhere.com

OR

someone@somewhere.com anyone@anywhere.com

I'm using PHP for scripting i would like to have the email ids extracted!

I'm expecting some cool solutions.

  • 写回答

3条回答 默认 最新

  • dongmu1951 2011-02-04 05:05
    关注

    Hi guys thanks for your patient and speedy replies but i found out a way i'll accept this only when you confirm it has no bugs.ie no replies for a day

    <?php
    $keywords = preg_split("/[\s,]+/", 
               "someone@somewhere.com,anyone@anywhere.com,",-1,PREG_SPLIT_NO_EMPTY);
    print_r($keywords);
    ?>
    

    OUTPUT

    Array
    (
        [0] => someone@somewhere.com
        [1] => anyone@anywhere.com
    )
    

    it was omitting even the extra comma at the end. even if i added more space waiting for your replies!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app