代码描述:php和json 应用实例。php和json的应用实例
在web建设中,php是绝对的主力之一,当然json在php的处理也不会少。 下面就分享一段代码实例,代码很简单,仅作参考之用。 代码如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.51qianduan.com/" /> <title>51前端</title> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> <script> $(document).ready(function(){ $.ajax({ type: "get", dataType: "json", url: "demo/JSON/php/json.php", success:function(msg){ var data = msg.book; var str=""; $.each(data,function(index, n){ str=str+"<div>"+ data[index]["range"]+","+ data[index]["author"]+","+ data[index]["target"]+ "</div>"; }); $("#books").html(str); } }); }) </script> </head> <body> <div id="books"></div> </body> </html>
请绑定手机号,在继续操作
注意:只有绑定手机以后,才可使用网站全部功能