<?php
switch ($type) {
case 'get':
get();
break;
case 'put':
put();
break;
//....
}
//查询
function get(){
$con=mysql_connect('localhost','root','123456') or die("连接失败");
$db_selected = mysql_select_db("user",$con);
$sql = "SELECT * from user WHERE id='1'";
$info = mysql_query($sql,$con);
mysql_close($con);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<ul>
<li>学号:<?php echo $info['num'];?></li>
<li>姓名:<?php echo $info['username'];?></li>
<li>年龄:<?php echo $info['age']; ?></li>
<li>性别:<?php echo $info['sex']; ?></li>
</ul>
</body>
</html>
这样写就是restul风格吧. 可是我想知道$type 从何而来?
目前暂无任何回答
- 0 回答
- 0 关注
- 1168 浏览
添加回答
举报
0/150
提交
取消