How does thinkphp get the returned value?

A set of data

is returned after simulated login using curl.

how do I get the st value under data?

$info = $this->curl_post_https("https://xxx/Home/logindo?fromSite=6",$cookie = tempnam("E:\wwwroot\tp5\public","cookie"),$data);
return $info["content"]["data"]["st"];

in this way,: Illegal string offset "content" is reported directly

.
Mar.02,2021

The estimated value returned by

is a string, which is processed using json_decode.

$info = json_decode($info, true);

this is data in json format that you can convert to array format via
json_decode ($data,true); so that you can get


in the way you write.
  

your return value is in json format. After conversion, you can print it out and take a look at the data structure. However, it is best to make a judgment to prevent the data from reporting errors for Null.

Menu