欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

用于测试api接口数据的输入输出

程序员文章站 2022-06-06 13:17:21
...

1. [代码][PHP]代码

<?php

$created = time();
$get = json_encode($_GET );
$post = json_encode($_POST );
$input = file_get_contents ( 'php://input' );
$cookie = json_encode($_COOKIE);


$con = mysql_connect("localhost","root","admin"); 
mysql_select_db("api_test", $con); 
$sql = "INSERT INTO api (created, get, post, input, cookie) VALUES ('$created', '$get', '$post', '$input', '$cookie')";
//echo $sql."\n";
mysql_query($sql,$con); 
mysql_close($con);

$str = '';

echo $str;

?>