Php 如何在web服务中传递值
我已经创建了一个示例web服务,这将返回一个Json数据。看起来像下面 现在,我希望使用用户名进行验证,用户名应该取值并相应地更改响应 像这样的Php 如何在web服务中传递值,php,web-services,get,Php,Web Services,Get,我已经创建了一个示例web服务,这将返回一个Json数据。看起来像下面 现在,我希望使用用户名进行验证,用户名应该取值并相应地更改响应 像这样的 如何添加此验证并相应地更改响应。谢谢你的帮助,谢谢 你可以这样做 <?php header('Content-type: application/json'); if($_GET["user"]) { $user = $_GET["user"];
如何添加此验证并相应地更改响应。谢谢你的帮助,谢谢 你可以这样做
<?php
header('Content-type: application/json');
if($_GET["user"])
{
$user = $_GET["user"];
// write your code that will use the user name
}
else
{
// return error or anything said the user is missing
}
?>
{
result: [
{
say: "omg",
dsay: "D omg",
},{
say: "bla",
dsay: "D bla",
},
]
}
<?php
header('Content-type: application/json');
if($_GET["user"])
{
$user = $_GET["user"];
// write your code that will use the user name
}
else
{
// return error or anything said the user is missing
}
?>