PHP截取指定字符前的字符串

$str = 'A|B||C|D';
echo substr($str,0,strpos($str, '||'));

输出:A|B

posted @ 2019-04-02 10:24  joker_one  阅读(10555)  评论(0编辑  收藏  举报