<p class="sougouContent"> </p> <p class="tag"> php CodeIgniter </p> <br> string(112) "{"code":"100","user":{"name":"张三"},"msg":"获取成功"}" <br> <br> <br> PHP 怎么获取 数组里面的 user 括号里面name 值呢? <br> <h2>回复讨论(解决方案)</h2> <p class="sougouAnswer"> <pre class="sycode" name="code">$s = '{"code":"100","user":{"name":"张三"},"msg":"获取成功"}';echo json_decode($s)->user->name; //张三</pre> </p> <p class="sougouAnswer"> json_decode 后就是对象/数组了,之后就容易了吧。 </p> <p class="sougouAnswer"> <pre class="sycode" name="code">$s = '{"code":"100","user":{"name":"张三"},"msg":"获取成功"}';echo json_decode($s)->user->name; //张三</pre> <br> <br> <br> <br> 版主太牛X <br> 了 <br> </p>