当前位置:网站首页>解决php无法将string转换为json的办法
解决php无法将string转换为json的办法
2022-07-05 19:56:00 【德宏大魔王】
背景:最近在开发小程序(替客户做的),一个水印小程序,通过接口实现了去掉水印,原理很简单,但是由于目标解析的地址域名太多,用了域名通配后也是出现不在合法域名中的错误,于是只能用自己的服务器来进行一个踏板,所以当数据回调后需要清洗数据出来给小程序用,在这里就出现了问题:
$result=send_post('https://****.cn/video.php', $post_data);
// $info = json_decode(trim($result),true);
$info=json_encode($result);
echo gettype($info);
通过json_decode、json_encode也无法转换为json,同样是string类型
解决办法:
去空trim()
解决代码:
$result=send_post('https://*****/video.php', $post_data);
$info = json_decode(trim($result),true);
echo gettype($info);

边栏推荐
- Common - Hero Minesweeper
- Debezium series: idea integrates lexical and grammatical analysis ANTLR, and check the DDL, DML and other statements supported by debezium
- 浮动元素与父级、兄弟盒子的关系
- okcc呼叫中心有什么作用
- Fundamentals of shell programming (Part 8: branch statements -case in)
- 信息/数据
- 秋招字节面试官问你还有什么问题?其实你已经踩雷了
- Complete interview questions for interviewers and senior Android engineers in front-line Internet enterprises
- Go language | 01 wsl+vscode environment construction pit avoidance Guide
- Is it safe to open a mobile stock account? Is it reliable?
猜你喜欢

Xaas trap: all things serve (possible) is not what it really needs

618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?

Recommended collection, my Tencent Android interview experience sharing

Force buckle 1200 Minimum absolute difference

leetcode刷题:二叉树16(路径总和)
![[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform](/img/64/08faef0fccec93337f0716ac57dd8e.jpg)
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform
成功入职百度月薪35K,2022Android开发面试解答

Inventory of the most complete low code / no code platforms in the whole network: Jiandao cloud, partner cloud, Mingdao cloud, Qingliu, xurong cloud, Jijian cloud, treelab, nailing · Yida, Tencent clo

2023年深圳市绿色低碳产业扶持计划申报指南

Let's talk about threadlocalinsecurerandom
随机推荐
S7-200SMART利用V90 MODBUS通信控制库控制V90伺服的具体方法和步骤
Debezium series: idea integrates lexical and grammatical analysis ANTLR, and check the DDL, DML and other statements supported by debezium
【无标题】
What is the function of okcc call center
随机数生成的四种方法|Random|Math|ThreadLocalRandom|SecurityRandom
[untitled]
Go language learning tutorial (16)
Common operators and operator priority
third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl
Xaas trap: all things serve (possible) is not what it really needs
Wildcard selector
Base du réseau neuronal de convolution d'apprentissage profond (CNN)
okcc呼叫中心有什么作用
Recommended collection, my Tencent Android interview experience sharing
gst-launch的-v参数
14. Users, groups, and permissions (14)
城链科技数字化创新战略峰会圆满召开
Information / data
完爆面试官,一线互联网企业高级Android工程师面试题大全
信息/数据