<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"> <div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">$s = '{"code":"100","user":{"name":"张三"},"msg":"获取成功"}';echo json_decode($s)->user->name; //张三</pre><div class="contentsignin">로그인 후 복사</div></div><div class="contentsignin">로그인 후 복사</div></div> </p> <p class="sougouAnswer"> json_decode 后就是对象/数组了,之后就容易了吧。 </p> <p class="sougouAnswer"> <div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">$s = '{"code":"100","user":{"name":"张三"},"msg":"获取成功"}';echo json_decode($s)->user->name; //张三</pre><div class="contentsignin">로그인 후 복사</div></div><div class="contentsignin">로그인 후 복사</div></div> <br> <br> <br> <br> 版主太牛X <br> 了 <br> </p>