jian1098/tp-constant
最新稳定版本:2.0.1
Composer 安装命令:
composer require jian1098/tp-constant
包简介
About thinkphp框架命令行创建常量class文件
README 文档
README
thinkphp框架命令行创建常量class文件
如何使用
-
安装
thinkphp5.*安装
1.0.1版本composer require jian1098/tp-constant:1.0.1然后在
application/command.php新增一行注册服务return [ 'Jian1098\TpConstant\Command\Make\Constant' ];
thinkphp6以上安装
2.0.1版本,不需要手动注册服务composer require jian1098/tp-constant:2.0.1
安装完成后在控制台输入
php think可以看到多了make:constant命令make make:command Create a new command class make:constant Create a new constant class # 新增的命令 make:controller Create a new resource controller class make:middleware Create a new middleware class make:model Create a new model class
-
使用命令行创建常量class
php think make:constant TestConstant
该命令会创建
application/common/constant/TestConstant.php文件 -
调用常量
<?php namespace app\api\controller; use app\common\constant\TestConstant; use think\Controller; class Test extends Controller { //index public function index() { var_dump(TestConstant::SERVER_ERROR); //使用常量 } }
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2024-05-07