Home > php教程 > PHP源码 > 用于测试api接口数据的输入输出

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

PHP中文网
Release: 2016-05-26 08:20:56
Original
1362 people have browsed it

                       

                       

1. [代码][PHP]代码   

           

<?php

$created = time();
$get = json_encode($_GET );
$post = json_encode($_POST );
$input = file_get_contents ( &#39;php://input&#39; );
$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 (&#39;$created&#39;, &#39;$get&#39;, &#39;$post&#39;, &#39;$input&#39;, &#39;$cookie&#39;)";
//echo $sql."\n";
mysql_query($sql,$con); 
mysql_close($con);

$str = &#39;&#39;;

echo $str;

?>
Copy after login

                   

                   

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template