扫码关注官方订阅号
$response = "HTTP/1.1 200 OKCache-Control: no-cacheContent-Type: application/json
{"code":0,"data":"操作成功","status":200}";
中间值返回这样的格式,但是我只想要包含{}在内的中间部分,求解?
$response->getContent();
json_decode 不行吗
你的返回值赋给$data
$request->data = json_deconde($data);
然后在Controller内使用 Request类来调用
$start = strpos($data, '{'); $result = substr($data, $start);
这样试试
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
json_decode 不行吗
你的返回值赋给$data
然后在Controller内使用 Request类来调用
这样试试