定制 anton-shevchuk/jquery-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

anton-shevchuk/jquery-php

最新稳定版本:1.0.1

Composer 安装命令:

composer require anton-shevchuk/jquery-php

包简介

jQuery-PHP is a PHP library that seamlessly integrates jQuery with PHP

README 文档

README

This library facilitates working with the jQuery framework from the server-side.

However, it's important to note that this approach is considered an antipattern. Server-side code typically shouldn't have knowledge of HTML structure or manipulate the DOM in this manner.

Requirements

  • PHP 7.4.0 or higher (with JSON extension)
  • jQuery 1.10 / 2.2 / 3.3 or higher

Documentation

Installation

Install Composer in Your Project.

Run this in your command line:

curl -sS https://getcomposer.org/installer | php

Or download composer.phar into your project root.

Execute this in your project root.

php composer.phar install

Usage

Add the autoloader to your PHP file.:

require 'vendor/autoload.php';

After this, you can use this jQuery-PHP library in your PHP code, for example, this is index.php:

use function AntonShevchuk\jQuery\jQuery;
use function AntonShevchuk\jQuery\jQueryContainer;

// create jQuery-way queries
jQuery('#demo')
    ->html('Server time: ' . date('H:i:s'))
    ->css('backgroundColor', '#ffffdd')
    ->animate(['opacity' => 'show'], 3000)
    ->animate(['opacity' => 'hide'], 3000)
;

// return JSON
print json_encode(jQueryContainer());

Include jQuery and jQuery-PHP library:

<!-- Load jQuery -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
<!-- Load main jQuery-PHP scripts -->
<script src="public/js/jquery.php.js"></script>

Add a call in your HTML page:

<!-- Call $.php -->
<button onclick="$.php('index.php',{'action':'demo'});return false;">Run demo snippet</button>
<!-- Target DOM Element -->
<div id="demo">...</div>

Examples

You can find more examples on the site: https://jquery.hohli.com

Author

The project is developed by Anton Shevchuk, and distributed under MIT LICENSE

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 3
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-17