简体   繁体   English

在浏览器中隐藏json数据

[英]Hide json data in from the browser which are getting in android app

I am pulling JSON values from the browser in my android app, but when I browse php files in the browser, the JSON data is displayed. 我正在从Android应用程序的浏览器中提取JSON值,但是当我在浏览器中浏览php文件时,将显示JSON数据。 My question is this: How can I hide the JSON data from the browser for security reasons? 我的问题是:出于安全原因,如何从浏览器隐藏JSON数据?

hi you can do one thing 嗨,你可以做一件事

when you want to fetch data from php , php must fetch data if the request sent by POST method , and contain parameter to check , for more explain 当您想从php获取数据时,如果请求是通过POST方法发送的,则php必须获取数据,并包含要检查的参数,以获取更多说明

in php file 在PHP文件中

<?php

if(isset($_POST['checked'] && $_POST['checked']=="password")
{

echo json_encode($json);

}

?>

now from android , when you send http request select post method , and add parameter checked="password" 现在从android,当您发送http请求时,请选择post方法,然后添加参数checked =“ password”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM