jump display
查找了数据库,再在while里拼接成json是很麻烦的,所以,jump display
获得数组
<?php
header("Content-Type:text/html; charset=utf-8");
/*json接口测试*/
$g=$_GET['g'];
$v=$_GET['v'];
$msu=$_GET['msu'];
print_r ($g);
print_r ($v);
print_r ($msu);
/*json*接口测试*/
//进行my数据库连接
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_query("set names utf8");//ut8声明
mysql_select_db("examples", $con);//打开my里的数据库
//显示my里的用户数据以便于添加参照
$my = mysql_query("SELECT name FROM `think_form` WHERE city = '上海' AND groupName = '专家'");
echo "[";
while($a=mysql_fetch_array($my))
{
echo json_encode($a['name']).",";
}
echo "]";
?>
再次修改显示内容,还可以做个伪接口
<?php
//get传值
header("Content-Type:text/html; charset=utf-8");
$g=$_GET['g'];
$urlg = "http://localhost/a.php?g=".$g ;
$contentsg = file_get_contents($urlg);
//如果出现中文乱码使用下面代码
//$getcontent = iconv("gb2312", "utf-8",$contentsg);
echo preg_replace('(,])',']',$contentsg);//preg_replace(find,被替换成,字符串)
echo "<br>";
?>
接口本来要传很多的参数,但是天晚了,想的费功夫,多写几个伪接口页面就得了。。。
jump display的更多相关文章
- 设备管理 USB ID
发现个USB ID站点,对于做设备管理识别的小伙伴特别实用 http://www.linux-usb.org/usb.ids 附录: # # List of USB ID's # # Maintain ...
- TRichTextBox – A universal RichTextBox which can display animated images and more
TRichTextBox – A universal RichTextBox which can display animated images and more trestan, 7 Dec 201 ...
- I.MX6 U-boot lvds display hacking
/*********************************************************************************** * I.MX6 U-boot ...
- CSS HTML元素布局及Display属性
本篇文章主要介绍HTML的内联元素.块级元素的分类与布局,以及dispaly属性对布局的影响. 目录 1. HTML 元素分类:介绍内联元素.块级元素的分类. 2. HTML 元素布局:介绍内联元素. ...
- 从display:run-in;中学习新技能
有时我们想在一行内显示一个标题,以及一段内容,虽然看起来比较简单,但是为了语义化用dl比较合适,但是它默认是block元素,改成inline?那么有多段呢?不就都跑上来了?用float?那问题也挺多. ...
- [转]thinkphp 模板显示display和assign的用法
thinkphp 模板显示display和assign的用法 $this->assign('name',$value); //在 Action 类里面使用 assign 方法对模板变量赋值,无论 ...
- [LeetCode] Frog Jump 青蛙过河
A frog is crossing a river. The river is divided into x units and at each unit there may or may not ...
- [LeetCode] Jump Game 跳跃游戏
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- [LeetCode] Jump Game II 跳跃游戏之二
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
随机推荐
- perl内置特殊变量查询
perl中有许多预定于的内置变量,想$_,$,,$>,等等,基本是记不住全部的用法,如果在因特网查阅,有很麻烦,信息不准啦,说的不细啦,但是,万能的perldoc早就帮我们准备好了. 你需要做的 ...
- vim:过一个字符
vim由插入模式进入编辑模式,会向前移动一个字符. 利用这个特性,我们可以用他来过一个字符. 什么情况需要过字符?比如:右括号.右引号等等,在括号中间,直接跳出,而不用方向键移动. 向前过一个字符,应 ...
- Go从入门到精通(一)go语言初识
一.第一个go程序 package main import ( "fmt" ) func main(){ fmt.Println("hello world") ...
- Spring 一二事(8) - annotation 形式的 MVC
<!-- component:把一个类放入到spring容器中,该类就是一个component 在base-package指定的包及子包下扫描所有的类 --> <context:co ...
- winphone开发环境配置
环境:操作系统win7 要进行winphone开发,必须进行一些环境的配置.下面是我的一些配置总结. 1.操作系统 winphone开发仅仅能在win8下开发.所以首先得安装win8.能够使用nt6 ...
- Java项目(5)——单例模式的应用与研究
单例模式是非常别致的一个模式,非常少有人拿它跟其它模式相比,由于,单例模式非常easy,非常特别,作用就是保证一个类有唯一一个实例,并让一个全局变量使得它能被訪问.而保证这个类仅仅被实例化一次的办法就 ...
- C# 通过 HTTPModule 防范 DOS
public class DosAttackModule : IHttpModule { void IHttpModule.Dispose() { } void IHttpModule.Init(Ht ...
- maven(2)------maven构建项目
一 下载maven 官网地址: http://maven.apache.org/download.cgi 如图: 可以下载历史版本. 二 windows下maven配置 1. 解压下载后的包,解压后 ...
- Laravel4.2取得配置文件值
Config::get('app.timezone'); laravel 使用Config::get方法来取得配置文件的值 laravel的配置文件的位置们于app.config文件夹的php文件中, ...
- 請問 localtime() 為什麼不會造成 memory leak?
http://www.programmer-club.com.tw/ShowSameTitleN/vc/22380.html ************************************* ...