简单的接口处理(一看就懂)
来源:互联网 发布:js require的用法 编辑:程序博客网 时间:2024/06/05 18:14
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>
<center>
<input type="text" name="net" />
<input type="button" id="search" value="查询" />
<div id="div1"></div>
</center>
</body>
</html>
<script src="jq.js"></script>
<script>
$(function(){
$("#search").click(function(){
var net=$("input[name='net']").val();
$.get("b.php?net="+net,function(data){
$("#div1").html(data);
})
})
})
</script>
php和memcache 处理html请求
<?php
header("connect-type:text/html;charset=utf-8");
if($_GET){
$net =$_GET['net'];
$mem = new Memcache();
$mem->connect('127.0.0.1',11211);
$re = $mem->get("net_$net");
//$mem->flush();die;
if(!$re){
$url ="http://api.k780.com:88/?app=life.areacode&areacode=$net&appkey=19795&sign=a5b8accdcd606114305060b452cd8de5&format=xml";
$obj =simplexml_load_file($url);
$json = json_encode($obj);
$arr =json_decode($json,true);
$short=$arr['result']['lists']['item_0']['areanm'];
print_r($short);
$mem->set("net_$net",$short);
}else{
$short=$re;
echo "这是缓存";
}
}else{
echo "非法操作";
}
?>
- 简单的接口处理(一看就懂)
- 最简单的servlet,一看就懂
- Struts2 简单的文件上传例子,一看就懂。
- 一看就懂的Redis简单操作及简介
- 一看就懂的设计模式(一,简单工厂模式)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的设计模式(二,工厂模式)
- 一看就懂的设计模式(三 ,外观模式)
- 一看就懂的设计模式(四,策略模式)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)
- 一看就懂的ReactJs入门教程(精华版)[转]
- 一看就懂的ReactJs入门教程(精华版)
- GCD调度组实现原理
- 自己理解的javascript静态方法和动态实例方法区别
- 浅析java多线程之Synchronized关键字
- 用js限制网页只在微信浏览器中打开,复制粘贴即可使用
- php验证码图片生成
- 简单的接口处理(一看就懂)
- 进程之间的通讯之共享内存
- 正式高一的第二十天
- 集线器、交换机、路由器、中继器及网关、网桥之间的区别
- 怎么打静态库.a及注意事项
- python调试用的Pycharm
- Ueditor 配置上传图片到项目外
- 移植驱动到内核学习笔记3-----LCD及输入系统
- bean的自动装配