$str = '{"res":"{\"type\":\"remove\",\"title\":\"10692467199507114(验证码)\",\"packgename\":\"com.android.mms\",\"time\":\"2020-10-21 12:47:53\",\"content\":\"【YY语音】您的验证码为:822124,10分钟内有效。如非本人操作,请忽略。\",\"id\":\"1390\"}"} '; $str = json_decode($str,true); $content = $str['res']; $content = json_decode($content,true); $content = $content['content']; $content = cut(":",",",$content); print_r($str); echo "<br>"; echo "====================<br>"; echo "截取后<br>"; echo "====================<br>"; echo $content; function cut($begin,$end,$str){ $b = mb_strpos($str,$begin) + mb_strlen($begin); $e = mb_strpos($str,$end) - $b; return mb_substr($str,$b,$e); }