在Json Response Body Php之前删除字符串 [英] Remove String Before Json Response Body Php

查看:110
本文介绍了在Json Response Body Php之前删除字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WHMCS Api,我得到了json格式的响应

Hi I am using WHMCS Api I am getting a response in json format like this

string 'userhowhigh83{"result":"success","orderid":787,"productids":"785","addonids":"","domainids":"","invoiceid":"766"}' (length=113)

我从API正确地获得了响应,但是它也给了我字符串'userhowhigh83',其中'howhigh83'是用户名,'user'是静态的,但是当我解码json结果时,它给了我null.当我删除'userhowhigh83'时,我在在线json解码器上签入,它可以正常工作.如何在json响应正文之前删除它.

I am getting the response correctly from API but it is also giving me the string 'userhowhigh83' where 'howhigh83' is the username and 'user' is given static but when I decode the json result it gives me null. I checked in on an online json decoder when I remove 'userhowhigh83' it will works fine.How can I remove this before json response body.

推荐答案

如果无法通过API获得更好的字符串形式,则始终可以使用字符串上的子字符串来摆脱"userhowhigh83":

If you cannot get the string in better shape from your API, you always can use substring on your string to get rid of "userhowhigh83" :

$string = substr($string , strpos($string , "{"));

这篇关于在Json Response Body Php之前删除字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆