当前位置:网站首页>解决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);
边栏推荐
- After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
- Common operators and operator priority
- leetcode刷题:二叉树17(从中序与后序遍历序列构造二叉树)
- Debezium series: PostgreSQL loads the correct last submission LSN from the offset
- S7-200smart uses V90 Modbus communication control library to control the specific methods and steps of V90 servo
- 多分支结构
- 安信证券在网上开户安全吗?
- Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
- Jvmrandom cannot set seeds | problem tracing | source code tracing
- 14. Users, groups, and permissions (14)
猜你喜欢
完爆面试官,一线互联网企业高级Android工程师面试题大全
Elk distributed log analysis system deployment (Huawei cloud)
Using repositoryprovider to simplify the value passing of parent-child components
四万字长文说operator new & operator delete
城链科技数字化创新战略峰会圆满召开
Go language | 02 for loop and the use of common functions
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform
Add data to excel small and medium-sized cases through poi
The city chain technology Digital Innovation Strategy Summit was successfully held
leetcode刷题:二叉树12(二叉树的所有路径)
随机推荐
gst-launch的-v参数
leetcode刷题:二叉树14(左叶子之和)
Common operators and operator priority
Jvmrandom cannot set seeds | problem tracing | source code tracing
Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
Debezium series: modify the source code to support drop foreign key if exists FK
C#应用程序界面开发基础——窗体控制(5)——分组类控件
Go language learning tutorial (16)
What is the function of okcc call center
Database logic processing function
力扣 1200. 最小绝对差
acm入门day1
深度學習 卷積神經網絡(CNN)基礎
leetcode刷题:二叉树10(完全二叉树的节点个数)
Reptile exercises (II)
Using repositoryprovider to simplify the value passing of parent-child components
Is it safe for Anxin securities to open an account online?
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
Bitcoinwin (BCW) was invited to attend Hanoi traders fair 2022
C application interface development foundation - form control (6) - menu bar, toolbar and status bar controls