• longhaoyu189@gmail.com

Category Archive 未分类

Gogs

官网

https://gogs.io/ 

编辑并设置服务

[Unit]
Description=Gogs
After=syslog.target
After=network.target
#After=mariadb.service mysql.service mysqld.service postgresql.service memcached.service redis.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root
Group=root
WorkingDirectory=/www/wwwroot/git.aqrboyblog.top/gogs
ExecStart=/www/wwwroot/git.aqrboyblog.top/gogs/gogs web
Restart=always
Environment=USER=root HOME=/www/wwwroot/git.aqrboyblog.top

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

刷新server

systemctl daemon-reload

启动服务

systemctl start gogs.service

laravel

1.创建一个名为laravel的laravel项目

composer create-project laravel/laravel --prefer-dist ./QZ_20_0712

命令解释:

composer:表示执行该程序;

create-project :创建项目

laravel/laravel:需要创建的项目名称;

–prefer-dist:优先下载压缩包方式,而不是直接从GitHub上下载源码

2.php artisan

(1)数据表

//创建迁移 建表
php artisan make:migration create_demo_table
//重建数据库,在原本的迁移文件中增加字段后执行
php artisan migrate:refresh
//数据表迁移
php artisan migrate
//数据表回滚
php artisan migrate:rollback

(2)功能列表

php artisan list

(3)make 列表

  make:cast             Create a new custom Eloquent cast class
  make:channel          Create a new channel class
  make:command          Create a new Artisan command
  make:component        Create a new view component class
  make:controller       Create a new controller class
  make:event            Create a new event class
  make:exception        Create a new custom exception class
  make:export           Create a new export class
  make:factory          Create a new model factory
  make:import           Create a new import class
  make:job              Create a new job class
  make:listener         Create a new event listener class
  make:mail             Create a new email class
  make:middleware       Create a new middleware class
  make:migration        Create a new migration file
  make:model            Create a new Eloquent model class
  make:notification     Create a new notification class
  make:observer         Create a new observer class
  make:policy           Create a new policy class
  make:provider         Create a new service provider class
  make:request          Create a new form request class
  make:resource         Create a new resource
  make:rule             Create a new validation rule
  make:seeder           Create a new seeder class
  make:test             Create a new test class

Docker

1.安装Docker

//Centos
yum install docker 

2.docker 基础命令

//启动docker
systemctl start docker
//关闭docker
systemctl stop docker
//重启docker
systemctl restart docker
//docker设置随服务启动而自启动
systemctl enable docker
//查看docker 运行状态
systemctl status docker

3.docker 镜像命令

//查看自己服务器中docker 镜像列表
docker images
//搜索镜像
docker search 镜像名
docker search --filter=STARS=9000 mysql 搜索 STARS >9000的 mysql 镜像
//拉取镜像 
docker pull 镜像名 
docker pull 镜像名:tag
//删除镜像
#删除一个
docker rmi -f 镜像名/镜像ID

#删除多个 其镜像ID或镜像用用空格隔开即可 
docker rmi -f 镜像名/镜像ID 镜像名/镜像ID 镜像名/镜像ID

#删除全部镜像  -a 意思为显示全部, -q 意思为只显示ID
docker rmi -f $(docker images -aq)
//强制删除镜像
docker image rm 镜像名称/镜像ID

4.docker 容器命令

//查看正在运行容器列表
docker ps
//查看所有容器 -----包含正在运行 和已停止的
docker ps -a
//运行一个容器
# -it 表示 与容器进行交互式启动 -d 表示可后台运行容器 (守护式运行)  --name 给要运行的容器 起的名字  /bin/bash  交互路径
docker run -it -d --name 要取的别名 镜像名:Tag /bin/bash 

微信双开终端命令

MAC 开第二个微信 终端不关闭

open -n /Applications/WeChat.app/Contents/MacOS/WeChat

/Applications/WeChat.app/Contents/MacOS/WeChat 为执行文件目录位置

WIN微信双开 创建 .bat 后缀脚本文件

@echo off
start "" "D:\WeChat\WeChat.exe"
start "" "D:\WeChat\WeChat.exe"
exit

D:\WeChat\WeChat.exe 为执行文件目录位置

PHP常用代码

PHP读写文件的方法

文件操作

// 判断是否是一个文件
var_dump(is_file('./demo.txt')); // bool(true)

// 读取文件字节数
var_dump(filesize('./demo.txt')); // int(11)

// 文件重命名
rename('./demo.txt', './demo.txt.bak');

// 删除文件
unlink('./demo.txt');

写入文件

// 打开文件
$file = fopen('./demo.txt', 'w');
// 只读:r
// 读写,文件覆盖:r+
// 清空写入:w
// 可创建清空写入:w+
// 追加写入:a
// 创建追加写入:a+

// 写入内容到文件
fwrite($file, 'Hello World');
// 关闭文件
fclose($file);

读取文件内容

// 写入内容到文件
fwrite($file, 'Hello World');
// 关闭文件
fclose($file);
$file = fopen('./demo.txt', 'r');
$filesize = filesize('./demo.txt');
$content = fread($file, $filesize);
var_dump($content); // string(11) "Hello World"
fclose($file);

通过快捷方式读取文件内容

// 读取文件到数组
$lines = file('./demo.txt');
var_dump($lines);
// array(4) {
//     [0]=>string(7) "赠人"
//     [1]=>string(22) "李群玉〔唐代〕"
//     [2]=>string(49) "曾留宋玉旧衣裳,惹得巫山梦里香。"
//     [3]=>string(48) "云雨无情难管领,任他别嫁楚襄王。"
// }
// 读取文件内容
$lines = file_get_contents('./demo.txt');
var_dump($lines);
// string(126) "赠人
// 李群玉〔唐代〕
// 曾留宋玉旧衣裳,惹得巫山梦里香。
// 云雨无情难管领,任他别嫁楚襄王。"