fly文档中文https://wendux.github.io/dist/#/doc/flyio/readme
https://unpkg.com/flyio/dist/fly.min.js
axios中文文档http://www.axios-js.com/
axioshttps://cdn.bootcss.com/axios/0.19.0/axios.min.js
qshttps://cdn.bootcss.com/qs/6.7.0/qs.min.js解决跨域
redaxios@0.5.1/dist/redaxios.js"target="_blank"">https://unpkg.com/redaxios@0.5.1/dist/redaxios.js 替代axios
npm install flyio

fly.get('{php echo $this->createWebUrl("ajax",["id"=>123])}')
    .then(function (response) {
        console.log(response.data);
    })
    .catch(function (error) {
        console.log(error);
    });
fly.get('/user', {
      id: 133
  }).then((response)=>{
                   console.log(response.data.list.user);
               })
fly.post('/user', {
    name: 'Doris',
    age: 24
    phone:"18513222525"
  })
fly.request('{php echo $this->createWebUrl("ajax",["id"=>123])}',{"qq":"234"},{method:"post"})  php需要file_get_contents("php://input");接收
var qs = require('qs');
//解决正常$_POST/$_GET接收
fly.post('/foo', qs.stringify({ 'bar': 123 }));

npm install axios

axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
axios.get('/user', {
    params: {
      ID: 12345
    }
  })
axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  }
});
const qs = require('qs');  
axios.post('/foo', qs.stringify({ 'bar': 123 }));
作者:Yoby  创建时间:2020-07-25 17:01
 更新时间:2024-12-05 13:26
上一篇:
下一篇: