<?php
$host ='localhost';
$user = "root";
$password = "";
$database = "contract resource management";
$server = mysql_connect($host, $user, $password);
$conn = mysql_select_db($database, $server);
连接数据库
$raw_post_data = file_get_contents('php://input');
$arr0 = json_decode($raw_post_data,true);
$phone = $arr0['phone'];
//post 数据方式
$query = mysql_query("SELECT * FROM user1 where phone='".$phone."'");//select 数据表
$selpass = mysql_fetch_array($query,MYSQL_BOTH);
$username=$selpass['name'];
$arr = array(
"name" => "$username",
"password" => "$userpassword"
);
$json_string = json_encode($arr);
//encode json格式数据
mysql_close( $server);
?>
网友评论