Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我无法删除&符号及其右侧的所有内容
5HnVGGOrMyw&1394058973
我不知道如何使用 RegEx 执行此操作,并且 rtrim() 对我不起作用。
为什么不使用substrand strrpos?
substr
strrpos
$string = substr($string, 0, strrpos($string, '&'));
$out = preg_replace('/([^&]*)&.*/', "$1", $in);
echo preg_replace("/([^&]+)(.+)/", '$1', '5HnVGGOrMyw&1394058973');