代码拉取完成,页面将自动刷新
composer create-project wang5202006s/ca-fast
cd ./ca-fast
mkdir ./runtime
chmod 777 -R ./runtime
启动 php ./bin/server.php 或 php ./bin/server.php start
停止 php ./bin/server.php stop
重启 php ./bin/server.php reload
1、一个极简的框架,轻松简单,无任何负担直接可用。
2、框架没有什么中间件,路由概念。也没有什么AOP,注解、验证器、ORM,简单的高效的框架无需这些东西。
3、框架当前不支持协程,请勿开启协程配置或hook。
4、遵循psr4。
1、Controllers (Swoole HTTP 服务使用的控制器目录)
路径规则举栗说明:
请求地址为:http://127.0.0.1:99/index/test
将会调用 控制器目录下 IndexController.php(IndexController类) 下的 actionTest方法。
这里的index表示需要调用的控制器 test表示需要执行的类方法
2、Commands (指令运行的控制器目录)
路径规则举栗说明:
php ./bin/cmd.php hello/index
将会调用 控制器目录下 HelloController.php(HelloController类) 下的 index方法。
这与上方不一致的地方就是 调用的方法无需在方法名前添加action标识。
3、FpmControllers (PHP-FPM HTTP 服务使用的控制器目录)
路径规则举栗说明:同Swoole HTTP
在config/config.php中添加一个数据库
config.php配置栗子:
<php
return [
'db' => [ //配置一个名称叫db的MYSQL配置 名称请勿与其他配置重名
'dsn' => 'mysql:host=127.0.0.1;dbname=test;charset=utf8mb4',
'username' => 'root',
'password' => '123456'
],
'db2' => [ //配置一个名称叫db2的MYSQL配置 名称请勿与其他配置重名
'dsn' => 'mysql:host=127.0.0.1;dbname=api;charset=utf8mb4',
'username' => 'test',
'password' => '654321'
]
];
$sql = "select * from user where nick like ? or username = ?";
$params = ['%张三%','张三'];
$users = Db::queryAll($sql,$params,'db');
$users = Query::find()->table('user')
->select('id,nick,sex,age')
->where(['sex' => 1])
->andWhere(['>=','age',20])
->andWhere(new Expression("nick like '%张三%' or username = '张三'"))
->all();
$user = Query::find->table('user')
->select(['id','nick','sex','age'])
->where(['id' => 1,'status' => 0])
->one();
$users = Query::find->table('user')
->select(['id','nick','sex','age'])
->where(['id' => 1,'status' => 0])
->all();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。