前端小程序,后端php,返回值里面有一堆html,怎么办?

小程序代码

            success:function(res) {
              console.log(res.data)
              console.log(res["keytoken"])

php后端

$res["code"]=$code;
$res["keytoken"]=$keytoken;
echo json_encode($res);

返回值是一堆html,最后是正确的值。

img


1.如何将返回值,去掉这些没用的html代码。
2.如何将返回值 的keytoken项取出来。
困扰了两天了,感谢

终于找到问题原因,原来是后台有错误,解决了就好了

你确定能这样写:res["keytoken"]