吴楚衡

来找我吧!我的目标是星辰大海!


  • 首页

  • 归档99

  • 标签77

  • 分类17

  • 关于

  • 历史

  • 书单

  • 工具

  • 搜索

【php】php学习笔记-laravelAPI全局异常设置

发表于 2019-12-13 | 更新于 2020-04-10

【Javascript】javascript笔记 -原型链

发表于 2019-12-10 | 更新于 2020-04-10 | 分类于 javascript

1 什么是原型链?

 在javascript声明一个变量,会自动继承一些属性和方法,这些都包含在__proto__属性和__proto__的__proto__中,从而定义好一个变量后,就能去使用它,如字符串的长度属性length,拼接的对象的方法concat等。而这些额外的属性和方法就是原型链了。那有没有纯粹的变量,没有原型链的?有的!
  用let foo = Object.create(__proto__: object, {} :boject) : object的方式可以定义一个无原型的对象(完全数据字典对象),如:

1
2
3
4
5
6
7
8
let foo = Object.create(null, {
name: {
value: "hello world"
}
}) : object

console.dir(foo);
// {name: "hello world"}

阅读全文 »

【心情文章】学习从来就不是一件开心的事

发表于 2019-12-10 | 更新于 2020-04-10 | 分类于 心情文章

 如果学习没有高考,不能帮助找到更好的工作从而改善自己的生存环境,你还会认为学习早一件快乐的事吗?不会的!学习从来就是痛苦的,它是反天性。人的天性就是喜欢享受,享受好的东西。而这些东西不是所有的人生来就有的。而为了得来这些,人们不得不训练自己,从而达到自己的目的。而这个训练就是学习。

阅读全文 »

【php】php函数摘要-加密和解密类

发表于 2019-12-08 | 更新于 2020-04-10 | 分类于 php

1支付宝小程序手机号解密

加密数据
1
2
3
4
{
"response": "EaieI1W9gPK0zClNbA7P0T6svaSYq/1xejihTXNVSH0WyCjBIcP2xOwaAevaYgb4aeQ5NNRQaqbZgVvfJKfaLQ==",
"sign": "iSHQH/r3rZiBx7N49SwQNHx2Y0B6OP2ePvhS+T2XKw9+dzt3T1W9T0cHSldFlkczcdPQ05Pi/bEygsZxip6StCNEqse7ou/nXx9QOAVNoBgZfb4bmFJxOl8DYeuF8VKQy+NdxuvRGJFpmVynZtSNy31BfD4663IowMj80/pfnmLJCEKqoS2oHWtGRRM7oIFEdCH5IJKCsq79qxFEPwmQVid2uN0XuL/Rg+lKN9eAbTGcBttVZGaI11vGDEBUq9sNksVJXWUHofszCeD9jGz8pGoNvApRt8Swe2RnVtWcnQ+Zh+G105fPpp3RYNZBSBV9EJJ5la5IEv8KfAwjW7jGFg=="
}
解密函数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
* 解密
*
* return mix
*/
function decryptData(string $encrypted_data)
{
$key = env('EAS');
$aesKey=base64_decode($key);
$iv = 0;
$aesIV=base64_decode($iv);
$aesCipher=base64_decode($encrypted_data);
$result=openssl_decrypt( $aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV);
return $result;
}
解密过程
1
2
3
echo decryptData('EaieI1W9gPK0zClNbA7P0T6svaSYq/1xejihTXNVSH0WyCjBIcP2xOwaAevaYgb4aeQ5NNRQaqbZgVvfJKfaLQ==');

// {"code":"10000","msg":"Success","mobile":"1342XXXXXXX"}

摘自

【laravel】dingo api自定义异常格式

发表于 2019-12-04 | 更新于 2020-04-10 | 分类于 php

dinggo api 自定义异常格式

在app/Pviders/AppServiceProvider的register方法加入.

1
2
3
4
5
6
7
8
9
10
11
12
\API::error(function (\Illuminate\Validation\ValidationException $exception){
$data =$exception->validator->getMessageBag();
$msg = collect($data)->first();
if(is_array($msg)){
$msg = $msg[0];
}
return response()->json(['message'=>$msg,'status_code'=>400], 200);
});
\API::error(function (\Dingo\Api\Exception\ValidationHttpException $exception){
$errors = $exception->getErrors();
return response()->json(['message'=>$errors->first(),'status_code'=>400], 200);
});

【PHP】composer使用笔记

发表于 2019-11-28 | 更新于 2020-04-10 | 分类于 php

laravel 全局函数文件配置(摘抄)

An easy and efficient way of creating a global functions file is to autoload it directly from Composer. The autoload section of composer accepts a files array that is automatically loaded.

Create a functions.php file wherever you like. In this example, we are going to create in inside app/Helpers.

Add your functions, but do not add a class or namespace.

1
2
3
4
5
6
<?php

function global_function_example($str)
{
return 'A Global Function with '. $str;
}
阅读全文 »

【CI/CD】代码修复工具StyleCI-文件配置

发表于 2019-11-22 | 更新于 2020-04-10 | 分类于 CI/CD

  StyleCI是一个代码格式规范的工具,它的作用于github提交代码后,触发去分析你的代码是否符合你配置的规范格式,然后也可以回头给你request pull这么一个纠正的代码合并请求,起到代码格式规范的这么一道警报线。StyleCI默认PHP是免费,更多语言官方文档有说明。这个是我laravel风格的.styleci.yml文件内容:

1
2
3
4
5
6
7
8
9
10
preset: laravel
risky: true
finder:
exclude:
- modules
- node_modules
- storage
- vendor
name: "*.php"
not-name: "*.blade.php"

也可以设置为symfony格式,更多格式也可以参考FriendsOfPHP/PHP-CS-Fixer

【Typescript】angular入门笔记-模板语法

发表于 2019-11-21 | 更新于 2020-04-10 | 分类于 Typescript

结构指令

1, 遍历指令
1
2
3
<div *ngFor="let product of products"> 
{{ product.name }}
</div>
阅读全文 »

【homestead】homestead切换为国内源

发表于 2019-11-20 | 更新于 2020-04-10 | 分类于 linux

把原来的/etc/apt/sources.list注释了,把下面的阿里云源加入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

【linux】linux笔记-常识常用命令小抄

发表于 2019-11-18 | 更新于 2020-04-10

解压tar.zx文件

首先要先安装tar工具,然后:
tar -xvf filename.tar.xz

开启和关闭网卡

1
2
ifdown <网卡名>
ifup <网卡名>

查看文件和目录大小

1
du -h --max-depth=<level> <path>
1234…10
吴楚衡

吴楚衡

IT菜鸟,写这个博客是防止未来把自己学习的东西给忘记了,也是为了自己学习的那点东西做下总结加深下印象,请多指教^_^!

99 日志
16 分类
76 标签
GitHub E-Mail
Links
  • hexo文档
  • 主题文档
  • linux学习平台
  • git使用手册
  • highlightjs
  • docker
  • cnlox
  • vim从入门到精通
  • 刺客博客
  • 算法牛人
  • 牛人
  • githhub开源书
  • 赖经纬
  • 徐庆业
  • next主题参考
粤ICP备17071471号 © 2020 吴楚衡
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Mist v6.7.0
|
0%