PHP 删除特定字符串之前的所有字符

2022-08-30 07:49:40

我需要在字符串内出现这种情况之前从任何字符串中删除所有字符:

"www/audio"

不知道我该怎么做。


答案 1

您可以使用 strstr 来执行此操作。

echo strstr($str, 'www/audio');

答案 2

考虑到

$string="We have www/audio path where the audio files are stored";  //Considering the string like this

您可以使用

strstr($string, 'www/audio');

$expStr=explode("www/audio",$string);
$resultString="www/audio".$expStr[1];

推荐