For examplehttp://www.baidu.com/xxxxxx.mp4?tag=MsjsIjdjajs
I need to remove it?tag=MsjsIjdjajs
天蓬老师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