We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
先安装 Apache 服务器,然后编写 php 代码即可,例如:
<?php echo ' { "resultCode": 0, "resultData": { "isFirstLogin": 1, "userType": "2", "userName": "itgoyo", "token": "5ae00462662f83bf1442d6e8a0c6c0a5" }, "resultMessage": "登录成功!", "resutlState": "SUCCESS" } '; ?>
安装 nodejs,然后写 js 代码,本地服务器测试,个人建议把 json 数据先压缩去除不必要的字符,例如:
var http = require('http') http.createServer(function (request, response) { response.writeHead(200, { 'Content-Type': 'application/json' }) response.end('{"resultCode":0,"resultData":{"isFirstLogin":1,"userType":"2","userName":"wujiafu","token":"5ae00462662f83bf1442d6e8a0c6c0a5"},"resultMessage":"登录成功!","resutlState":"SUCCESS"}'); }).listen(8888); console.log('Server running');
这样子可以快速自定义返回数据类型,真是太方便了,不用再写 java 代码呢
The text was updated successfully, but these errors were encountered:
由于nodejs存在跨域的问题,所以代码优化了一下:
var http = require('http') http.createServer(function (request, response) { response.writeHead(200, { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' }) response.end('{"resultCode":0,"resultData":{"isFirstLogin":1,"userType":"2","userName":"wujiafu","token":"5ae00462662f83bf1442d6e8a0c6c0a5"},"resultMessage":"登录成功!","resutlState":"SUCCESS"}'); }).listen(8888); console.log('Server running');
Sorry, something went wrong.
No branches or pull requests
方法一 Apache+php
先安装 Apache 服务器,然后编写 php 代码即可,例如:
方法二 nodejs
安装 nodejs,然后写 js 代码,本地服务器测试,个人建议把 json 数据先压缩去除不必要的字符,例如:
这样子可以快速自定义返回数据类型,真是太方便了,不用再写 java 代码呢
The text was updated successfully, but these errors were encountered: