确定JSON结果是否为EMPTY [英] Determine if JSON result is EMPTY

查看:445
本文介绍了确定JSON结果是否为EMPTY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码在PHP中生成我的json

I am using below code to generate my json in PHP

然后我得到正确的结果然后阅读这就是我的.NET应用程序:

and I a m getting the correct result then reading it this way my .NET app:

password_salt = data[0].password_salt.ToString();

但我想知道如何检查结果是否为空而无需在 中手动添加结果(true,false)字段我的PHP?

but I want to know how can i check if the result is empty without having to add a result (true, false) field manually in  my php?

换句话说:

if(json为空)然后

if (json is empty) then

    MessageBox.Show('no result');

   MessageBox.Show('no result');

else

   显示结果......

   Display the result...

我的PHP代码在这里:

my PHP code is here:

$mysql_query = $mysql_connection->prepare('CALL sp_get_password_salt(:param_email)');
$mysql_query->bindParam(':param_email', $email, PDO::PARAM_STR);

$mysql_query->execute();

if ($mysql_query->rowCount() > 0)
{
    $jsonData = array();

    while($mysql_row = $mysql_query->fetch())
    {
      $jsonData[] = $mysql_row;
    }

    echo json_encode($jsonData, JSON_NUMERIC_CHECK);
}  




推荐答案

您好Jassim RAhma,

Hi Jassim RAhma,

感谢您发布此处。

对于您的问题,如何从PHP存储数据?你如何在C#中阅读它?

For your question, how to do store the data from the PHP? And how do you read it in C#?

在C#中,如果你想检查json是否为空,你可以使用if else。但是你想了解更多关于php的信息,你可以在StackOverFlow中发帖。

In C#, if you want to check the json is empty or not, you could use the if else. But is you want to know more about php, you could post in StackOverFlow.

https:/ /stackoverflow.com/questions/tagged/php

最好的问候,

Wendy


这篇关于确定JSON结果是否为EMPTY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆