当前位置:网站首页>解决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);
边栏推荐
- DP:树DP
- Is it safe for Anxin securities to open an account online?
- webuploader文件上传 拖拽上传 进度监听 类型控制 上传结果监听控件
- 字节跳动Dev Better技术沙龙成功举办,携手华泰分享Web研发效能提升经验
- SecureRandom那些事|真伪随机数
- Fundamentals of shell programming (Part 8: branch statements -case in)
- Base du réseau neuronal de convolution d'apprentissage profond (CNN)
- Successful entry into Baidu, 35K monthly salary, 2022 Android development interview answer
- 浅浅的谈一下ThreadLocalInsecureRandom
- The city chain technology Digital Innovation Strategy Summit was successfully held
猜你喜欢
What is the core value of testing?
浅浅的谈一下ThreadLocalInsecureRandom
如何安全快速地从 Centos迁移到openEuler
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
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform
CADD课程学习(7)-- 模拟靶点和小分子相互作用 (半柔性对接 AutoDock)
软件测试是干什么的?学习有啥要求?
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
Based on vs2017 and cmake GUI configuration, zxing and opencv are used in win10 x64 environment, and simple detection of data matrix code is realized
随机推荐
Fundamentals of shell programming (Chapter 9: loop)
Common operators and operator priority
【c语言】归并排序
Float. The specific meaning of the return value of floattorawintbits is to convert float into byte array
leetcode刷题:二叉树11(平衡二叉树)
图嵌入Graph embedding学习笔记
Fundamentals of shell programming (Part 8: branch statements -case in)
Securerandom things | true and false random numbers
Tasks in GStreamer
Fundamentals of deep learning convolutional neural network (CNN)
aggregate
【c语言】快速排序的三种实现以及优化细节
Multi branch structure
Flume series: interceptor filtering data
Elk distributed log analysis system deployment (Huawei cloud)
What do software test engineers do? How about the prospect of treatment?
SecureRandom那些事|真伪随机数
安卓面试宝典,2022Android面试笔试总结
处理文件和目录名
Is it safe for Anxin securities to open an account online?