sunmant/phpconst2js 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sunmant/phpconst2js

Composer 安装命令:

composer require sunmant/phpconst2js

包简介

A small library for converting PHP class constants to JSON array. You can use it when you new constants values from PHP backend in JavaScript code

README 文档

README

What is it?

  • A small library that outputs PHP class constants as JSON array for transfering constants values from PHP backend to JavaScript code

How to use it?

  • Add PHPConst2JScode to your project composer require sunmant/phpconst2jscode
  • create PHPConst2JScode object: $c = new PHPConst2JScode()
  • add class with constants you need in your JS code: $c->addClassConstants(ClassWithConstants::class);
  • get constants JSON and add it to your JS code, for example like this: echo 'var PHPConstants = ' . $c->getJSON(); (It is better to use fully qualified class names here than aliases)
  • now you can use PHP constants values in yourJS code: var someConstantValue = PHPConstants['ClassWithConstants::SOME_CONSTANT'];

What else?

  • PHP 5 or higher is required

Author?

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-12-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固