fmihel/ajax
最新稳定版本:v2.0.3
Composer 安装命令:
composer require fmihel/ajax
包简介
ajax responser of apache/php server
README 文档
README
Install
$ npm i fmihel-ajax $ composer require fmihel/ajax
run script for remove js files from vendor path
$ cd ./vendor/fmihel/ajax && ./composer-after-install.sh && cd ../../../
Simple use
file struct
path
|-path1
| |-path2
| |-mod.php
|-index.php
|-client.js
client.js
import ajax from 'fmihel-ajax'; ajax::send({ to:'path1/path2/mod', data:{ msg: 'send msg to server',any_num:10,arr:[1,32,4,2]}, }) .then(data=>{ console.info(data); }) .catch(e=>{ console.error(e); });
mod.php in folder <path-of-index.php>/path1/path2
<?php use fmihel\ajax\ajax; error_log(print_r(ajax::data(),true)); ajax::out('hi, from server'); ?>
index.php
<?php require_once __DIR__.'/vendor/autoload.php'; use fmihel\ajax\ajax; if (ajax::enabled()){ ajax::init(); require_once ajax::module(); ajax::done(); }; ?>
统计信息
- 总下载量: 1.25k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-20