摘要: 查询操作: User::find()->one(); //返回一条数据; User::find()->all(); //返回所有数据; User::find()->count(); //返回记录的数量; User::find()->average(); //返回指定列的平均值; User::find 阅读全文
posted @ 2021-06-22 23:52 胡勇健 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 1 添加文件 /basic/models/service/StudentService.php <?php namespace app\models\service; use yii\base\BaseObject; class StudentService extends BaseObject { 阅读全文
posted @ 2021-06-22 23:46 胡勇健 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1 ubuntu18安装redis 2 yii2安装插件yii2-redis sudo composer require --prefer-dist yiisoft/yii2-redis:"~2.0.0" -vvv 3 /basic/config/web.php components添加 'redi 阅读全文
posted @ 2021-06-22 23:43 胡勇健 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1 /basic/config/web.php 添加 'bootstrap' => ['log'], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'le 阅读全文
posted @ 2021-06-22 23:40 胡勇健 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1 添加自定义组件文件 /basic/components/MyComponent.php <?php namespace app\components; use yii\base\Component; class MyComponent extends Component { public $na 阅读全文
posted @ 2021-06-22 23:39 胡勇健 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 1 添加behavior文件 /basic/components/behavior/MyBehavior.php <?php namespace app\components\behavior; use yii\base\Behavior; class MyBehavior extends Beha 阅读全文
posted @ 2021-06-22 23:36 胡勇健 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 1 /basic/controllers/TestController.php 添加方法 public function actionTest(){ $person = new Person(); $this->on('SayHello', [$person,'say_hello'],'你好,朋友 阅读全文
posted @ 2021-06-22 23:32 胡勇健 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 1 默认cache 默认保存路径/basic/runtime/cache/ Yii::$app->cache->set('name','huyongjian'); $v = Yii::$app->cache->get('name'); 2 cache使用redis保存 a 安装redis (yii2 阅读全文
posted @ 2021-06-22 23:28 胡勇健 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 获取config params.php配置的参数 $id = Yii::$app->params['adminEmail']; var_dump($id); 获取参数 $post = Yii::$app->request->post('name'); $get = Yii::$app->reques 阅读全文
posted @ 2021-06-22 23:26 胡勇健 阅读(99) 评论(0) 推荐(0) 编辑
摘要: df -h 查看磁盘空间占用情况 1 进入根目录: cd / 2 使用命令: du -sh //查看根目录下每个文件夹的大小 3 进入占用空间比较大的文件夹,然后再使用2中命令查找大文件 du -ah --max-depth=1 解决 Argument list too long 参数列表过长的办法 阅读全文
posted @ 2021-06-22 23:17 胡勇健 阅读(8566) 评论(0) 推荐(0) 编辑
摘要: 1 定义别名 // 文件路径的别名 Yii::setAlias('@foo', '/path/to/foo'); // URL 的别名 Yii::setAlias('@bar', 'http://www.example.com'); // 包含 \foo\Bar 类的具体文件的别名 Yii::set 阅读全文
posted @ 2021-06-22 15:47 胡勇健 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1 nginx 重定向 server { listen 80; root /vagrant/basic/web; index index.html index.htm index.php; server_name www.basic.com; location / { index index.php 阅读全文
posted @ 2021-06-22 15:44 胡勇健 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 1 basic/config/db.php添加 return [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=172.16.8.12;dbname=student', 'username' => 'root', 'password' => 阅读全文
posted @ 2021-06-22 15:40 胡勇健 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 前言 Redis是常用基于内存的Key-Value数据库,比Memcache更先进,支持多种数据结构,高效,快速。 用Redis可以很轻松解决高并发的数据访问问题;作为实时监控信号处理也非常不错。 环境 Ubuntu 18.04 安装Redis服务器端 sudo apt-get install re 阅读全文
posted @ 2021-06-22 15:36 胡勇健 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI) hdparm -i /dev/hda 罗列一个磁盘的架构特性 hdparm -tT / 阅读全文
posted @ 2021-06-22 15:26 胡勇健 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-06-22 15:08 胡勇健 阅读(44) 评论(0) 推荐(0) 编辑
摘要: git常用命令 1 git clone https://git.coding.net/hyj2016/blog.git 注释:克隆远程仓库的项目代码到本地库 2 git status 注释:查看当前所在分支 3 git add . 注释:添加项目修改的文件到本地库 4 git commit -m ' 阅读全文
posted @ 2021-06-22 14:59 胡勇健 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 前端UI框架介绍 Bootstrap 使用世界上最流行的前端组件库在web上构建响应性、移动优先的项目。 网址:http://getbootstrap.com/ amaze UI HTML5 跨屏前端框架,为移动而生,组件丰富,模块化,本地化支持,轻量级,高性能 网址:http://amazeui. 阅读全文
posted @ 2021-06-22 14:52 胡勇健 阅读(527) 评论(0) 推荐(0) 编辑
摘要: 版本控制系统 Git Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。 Git的优缺点如下: 1.适合分布式开发,每一个个体都可以作为服务器。 2.公共服务器压力和数据量都不会太大。 3.速度快、灵活,分支之间可以任意切换。 4.任意两个开发者之间可以很容易的解决冲 阅读全文
posted @ 2021-06-22 14:44 胡勇健 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 理解 promise是解决异步处理回调问题 Promise对象状态 pending: 初始状态,不是成功或失败状态。 fulfilled: 意味着操作成功完成。 rejected: 意味着操作失败。 用法 const p = new Promise((resolve,reject)=>{ setTi 阅读全文
posted @ 2021-06-22 14:26 胡勇健 阅读(71) 评论(0) 推荐(0) 编辑