search

Home  >  Q&A  >  body text

PHP regular problem, how to remove it? Content after the beginning

For examplehttp://www.baidu.com/xxxxxx.mp4?tag=MsjsIjdjajs

I need to remove it?tag=MsjsIjdjajs

小可耐小可耐1945 days ago996

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2019-07-25 14:14:45

    This requirement is very simple. You don’t need to use regular expressions. String functions can handle it:

    <?php
    
    $str = 'http://www.baidu***/xxxxxx.mp4?tag=MsjsIjdjajs';
    
    echo strstr($str, '?', true);
    
    // 结果: http://www.baidu***/xxxxxx.mp4


    reply
    0
  • Cancelreply