raylee-blog

keep walking


  • Home

  • Archives

Python Sanic chrome CORS

Posted on 2019-07-19

使用sanic 框架 用vue-axiso发出请求在Chrome 的console 中报 Access to XMLHttpRequest at ‘http://xxxxxxxx' from origin ‘null’ has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. 和 ‘Access-Control-Allow-Origin’ 跨域问题

主要是chrome的安全限制跨站请求需要同源,或者就需要在服务端设置返回头以允许跨站请求。在sanic中,之间用中间件方法,对请求和返回进行统一添加头,对post前的option预检请求进行相应即可,具体代码片段:

1
2
3
4
5
6
7
8
9
10
11
@app.middleware('request')
async def print_on_request(request):
if request.method == 'OPTIONS':
return response.json(None)

@app.middleware('response')
async def prevent_xss(request, response):
if 'X-Error-Code' not in dict(response.headers):
response.headers['X-Error-Code'] = 0
response.headers["Access-Control-Allow-Origin"] = "*"
response.headers["Access-Control-Allow-Headers"] = "X-Custom-Header,content-type"

参考资料:
跨域资源共享 CORS 详解 : http://www.ruanyifeng.com/blog/2016/04/cors.html
Sanic 中间件 和 监听器 :https://sanic-cn.readthedocs.io/zh/latest/sanic/middleware.html#

Ubuntu Note --- upgrade python3.5 to python3.7 on ubuntu 16.04

Posted on 2019-04-03

前段时间一直用Windows写代码,用到了了一些python3.6+才有的语法特性,结果放到自己的服务器上跑不起来,手动编译安装了python3.7,运行的时候有些依赖依然解析到3.5上去了,无赖,查找升级系统的python版本

google出来的常用的错误办法就是:

1
2
3
4
5
sudo add-apt-repository ppa:jonathonf/python-3.7
sudo apt update
sudo apt install python3.7

python3.7 -m pip install pipenv

结果依然报错
ImportError: cannot import name ‘sysconfig’ (Ubuntu 16.04)

google 良久,发现天坑,原来ppa:jonathonf的库有问题,用ppa:deadsnakes/ppa这个就完美升级了

再来一次,正确的:

1
2
3
4
5
6
7
8
sudo apt autoremove python3.7
sudo rm -rf /etc/apt/sources.list.d/jonathonf-ubuntu-python-3*
sudo apt update
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7

python3.7 -m pip install pipenv

Git Note--git submodule usage

Posted on 2019-03-19

Usage of git submodule command

0x00 add a submodule to a repo

Sometimes our project may depends on other’s git project,so,how to handle this dependence in git ,just use git submodule

1
git submodule add https://github.com/other/reponame reponame

after this command , git will create a sub directory named at current work directory,

1
2
3
4
5
6
ls reponame

#you may see something or nothing,because old version git will not auto pull submodule repo
#you can run the follow cmdline,manual pull submodule repo

git submodule update --init --recursive

0x01 clone a repo with it submodule repos

1
git clone --recursive <project url>

0x02 more useful info

https://github.blog/2016-02-01-working-with-submodules/

Algorithm Note --- 堆与栈

Posted on 2019-03-18

前言:

作为野生程序员,总是提到堆栈,堆栈,其实长久以来并不理解其真正的区别,今天深入学习之后,记录记录,加深记忆!!!

堆栈的区分

0x00、写代码的时候所说的堆与栈

  • 栈,一种先进后出(FILO)的数据结构,如同一个箱子,往里面放书进去,想要拿到箱子底部的那本书就必须把上面的书全部取出来之后才能拿到。
  • 堆, 一种经过排序的树形数据结构,每个结点都有一个值。通常我们所说的堆的数据结构,是指二叉堆。堆的特点是根结点的值最小或最大(因此也有最小堆和最大堆之分),且根结点的两个子树也是一个堆。由于堆的这个特性,常用来实现优先队列,堆的存取是随意,就像一栋大楼的不同单元,每层又像一个子树,知道楼栋单元号就可以直接去拜访,而不需要一层一层的找

0x01、计算机内存分配上所说的堆与栈–堆区与栈区

以C语言程序内存分配为例,这里所说的堆和栈就是指计算机内存中的堆区和栈区,我们知道程序在运行时需要将代码拷贝到内存中执行,计算机系统会在内存中分配空间来分别存储代码运行时所需的不同信息:
栈区和堆区就是其中两个空间。除此之外,还有BSS段、数据段、代码段等分区。
2474121-e6e531010176eb33.png

  • 栈区、作为内存中存储结构,通常存放程序临时创建的局部变量,即函数括大括号 “{ }” 中定义的变量,其中还包括函数调用时其形参,调用后的返回值等。 栈是由到高地址向低地址扩展的数据结构。即依次定义两个局部变量,首先定义的变量的地址是高地址,其次变量的地址是低地址。栈还具有“小内存、自动化、可能会溢出”的特点。栈顶的地址和栈的最大容量一般是系统预先规定好的,通常不会太大。由于栈中主要存放的是局部变量,而局部变量的占用的内存空间是其所在的代码段或函数段结束时由系统回收重新利用,所以栈的空间是循环利用自动管理的,一般不需要人为操作。如果某次局部变量申请的空间超过栈的剩余空间时就有可能出现 “栈的溢出”,进而导致意想不到的后果。所以一般不宜在栈中申请过大的空间,比如长度很大的数组、递归调用重复次数很多的函数等等。
  • 堆区、通常存放程序运行中动态分配的存储空间。堆是低地址向高地址扩展的数据结构,是一块不连续的内存区域。在标准C语言上,使用malloc等内存分配函数是从堆中分配内存的,在Objective-C中,使用new创建的对象也是从堆中分配内存的。
    堆具有“大内存、手工分配管理、申请大小随意、可能会泄露”的特点,堆内存是操作系统划分给堆管理器来管理的,管理器向使用者(用户进程)提供API(malloc和free等)来使用堆内存。需要程序员手动分配释放,如果程序员在使用完申请后的堆内存却没有及时把它释放掉,那么这块内存就丢失了(进程自身认为该内存没被使用,但是在堆内存记录中该内存仍然属于这个进程,所以当需要分配空间时又会重新去申请新的内存而不是重复利用这块内存),就是我们常说的-内存泄漏,所以内存泄漏指的是堆内存被泄露了。
  • BSS段、
    Block Started by Symbol的简称,通常是指用来存放程序中未初始化的全局变量和静态变量。
  • 数据段、 通常是指用来存放程序中已初始化的全局变量和静态变量以及字符串常量
  • 代码段、
    通常是指用来存放程序执行代码的一块内存区域。这部分区域的大小在程序运行前就已经确定。

    0x03、典型关于各种变量在内存中分配位置的例子

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    #include <stdio.h>
    int a = 0; // 全局初始化区
    char p1; // 全局未初始化区
    int main(int argc, const char * argv[]) {
    int b ; // 栈
    char s[] = "abc"; // 栈
    char p2 ; // 栈
    char p3 = "123456"; // 123456在常量区,p3在栈上。
    static int c = 0 ; // 全局(静态)初始化区
    p1 = (char )malloc(10); // 分配的10字节的区域就在堆区
    p2 = (char )malloc(20); // 分配的20字节的区域就在堆区
    printf("%p\n",p1); // 0xffffffb0
    printf("%p\n",p2); // 0xffffffc0
    return 0;
    //p1 变量的地址 0xffffffb0 比 p2 变量的地址 0xffffffc0 要小
    }

参考链接:

https://www.cnblogs.com/jiahuafu/p/8575044.html
https://www.jianshu.com/p/b2380e47d005

WIN10 专业版激活

Posted on 2019-02-16

用管理员身份运行CMD

依次运行下面的命令

slmgr.vbs /upk
slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr /skms zh.us.to
slmgr /ato

升级Ubuntu18.04的linux kernel(修复小米游戏本的触摸板驱动问题)

Posted on 2019-01-22

前言:

前一段时间换电脑,置换了小米的游戏本,装了ubuntu18.04的系统,demesg发现一直报一个关于i2c接口的错误:

[ 473.518316] i2c_hid i2c-CUST0001:00: i2c_hid_get_input: incomplete report (14/65535)
[ 473.518951] i2c_hid i2c-CUST0001:00: i2c_hid_get_input: incomplete report (14/65535)

几经google,原来是小米游戏本用的触摸板模块驱动在我当前的Linux kernel版本上有兼容问题,遂升级内核。。。

一、下载ubuntu升级用的内核文件

下载地址:https://kernel.ubuntu.com/~kernel-ppa/mainline/

uname -a
Linux ray-ubuntu 4.15.0-44-generic #47-Ubuntu SMP Mon Jan 14 11:26:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • 我当前系统的kernel版本是4.15,,我这个问题要安装>=4.17的版本,找到一个v4.17.19的版本目录,进去:Screenshot from 2019-01-22 15-53-06.png

  • 下载对应系统版本的kernel deb包:

    linux-headers-VERSION-NUMBER_all.deb
    linux-headers-VERSION-NUMBER_amd64.deb
    linux-image-VERSION-NUMBER_amd64.deb
    linux-modules-VERSION-NUMBER_amd64.deb

至于你是下low-latency 还是 generic的版本,看你的想法了,
可以参考这个问答:https://askubuntu.com/questions/126664/why-choose-a-low-latency-kernel-over-a-generic-or-realtime-one
一般自用generic就行

二、安装升级内核

切换到你下载的这些文件的目录,最好用单独一个目录存放上面下载的包

1
2
cd /path/to/folder/where/you/put/the/debs
sudo dpkg -i *.deb

三、重启开始工作在新内核

1
sudo apt-get update && sudo apt-get dist-upgrade && sudo reboot

腾讯云服务器(CVM主机 Ubuntu系统)一个弹性网卡绑定多个IP地址的方法

Posted on 2019-01-20

前言:

最近项目需求,需要多个外网ip地址,防止一些梯子或爬虫项目被封。又不想开多个云服务器,浪费资源,正好腾讯云的CVM的弹性网卡支持单网卡多辅助IP,遂以此出发,为云主机绑定了4个不同的外网IP,网上搜到的资源都是教配置Fedora系统的,我用的ubuntu16.04为服务器的系统,有点不同,所以记录下来,希望能对一些朋友有帮助~~

一、创建云主机并绑定弹性网卡

创建云主机后一定要将默认的网卡换成弹性网卡,在左边栏有弹性网卡,点开在CVM的对应地理区域创建弹性网卡,没有绑定会提示收费,点击绑定,选中相应的CVM主机就好,附上不同CVM配置能绑定的IP数量:
Screenshot from 2019-01-20 11-20-41.png
我是1核2G,我绑定了4个IP,舒服,哈哈~~~
修改为弹性网卡后,CVM主机如下显示
Screenshot from 2019-01-20 11-21-59.png
主IP地址后面会出现 弹性 两个字哟~~

二、为弹性网卡添加辅助ip

1、先添加内网IP

点击创建的CVM实例名称,进入实例的详细信息页,选择详细页上的弹性网卡tab,进入到下面的页面
Screenshot from 2019-01-20 11-29-43.png
点击右上角分配内网IP,为此网卡添加辅助内网IP,我添加了如下三个,加上主网卡一共4个IP

2、为刚添加的内网IP分配外网IP

添加完内网IP后,点击左侧菜单栏,到弹性网卡,就是最开始为CVM配置弹性网卡的页面,在CVM对应区域添加3个弹性ip,操作和第一步为CVM添加弹性ip一样,创建好就绑定到CVM上,完成后如下图:
Screenshot from 2019-01-20 12-14-11.png
回到刚才实例详情页面就能看到之前添加的内网ip后面出现了刚才添加的公网ip了:
Screenshot from 2019-01-20 11-29-43.png
3、腾讯云控制台的操作就完成了

三、Ubuntu系统上的多IP绑定配置

配置相对Fedora是比较简单的:

1、禁用云主机的自动配置

查看网卡配置

cat /etc/network/interfaces.d/50-cloud-init.cfg

1
2
3
4
5
6
7
8
9
10
11
12
>> cat /etc/network/interfaces.d/50-cloud-init.cfg

# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

上面写着要想自定义网络配置需要禁用掉自带的云初始化,方法是创建文件

/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

并添加如下内容

network: {config: disabled}

那就照做就是:

1
sudo bash -c "echo 'network: {config: disabled}' > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg"

2、手动配置我们的网卡信息

主要是修改网络接口配置文件

vim /etc/network/interfaces

需要的内容一定要照着控制台显示的各个内网IP填,网关和子网掩码用

route

查看确认,我一直以为子网掩码用255.255.255.0,结果我一看却是255.255.240.0

1
2
3
4
5
>> route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 172.16.0.1 0.0.0.0 UG 0 0 0 eth0
172.16.0.0 * 255.255.240.0 U 0 0 0 eth0

添加如下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

#source /etc/network/interfaces.d/* 注释掉原来的配置

auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 172.16.0.6 #主网卡的内网IP
netmask 255.255.240.0 #子网掩码
gateway 172.16.0.1 #网关,一般为内网第一个.1的IP

# more side ip
auto eth0:1 #辅助IP的网卡名,自己定义,这样写比较表意
iface eth0:1 inet static
address 172.16.0.4 #辅助IP的内网IP
netmask 255.255.240.0
gateway 172.16.0.1

auto eth0:2
iface eth0:2 inet static
address 172.16.0.8
netmask 255.255.240.0
gateway 172.16.0.1

auto eth0:3
iface eth0:3 inet static
address 172.16.0.17
netmask 255.255.240.0
gateway 172.16.0.1

保存退出,基本完工

四、重启查看并测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
>> ifconfig
eth0 Link encap:Ethernet HWaddr ***********
inet addr:172.16.0.6 Bcast:172.16.15.255 Mask:255.255.240.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:87641 errors:0 dropped:0 overruns:0 frame:0
TX packets:87248 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5342944 (5.3 MB) TX bytes:5588316 (5.5 MB)

eth0:1 Link encap:Ethernet HWaddr ***********
inet addr:172.16.0.4 Bcast:172.16.15.255 Mask:255.255.240.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:2 Link encap:Ethernet HWaddr ***********
inet addr:172.16.0.8 Bcast:172.16.15.255 Mask:255.255.240.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:3 Link encap:Ethernet HWaddr ***********
inet addr:172.16.0.17 Bcast:172.16.15.255 Mask:255.255.240.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

成功撒花,愉快的开始其它的业务吧~~~~

详细Hexo博客搭建:云端写作+自动构建+自动部署

Posted on 2019-01-17

YuQue云端写作+Travis-ci自动构建+github-pages发布

序言:在网上看见Nero大神的一篇文章https://segmentfault.com/a/1190000017797561,简单讲述了如何构建一个云端写作自动部署到github pages的hexo 静态博客网站,之前我已经在github pages上搭建了一个博客,无奈觉得每次写作非常不方便,用代码编辑器vs code写md文档然后手动生成静态再部署,写作环境实在太差,之后便放弃直接在CSDN上写了。看到上面那篇文章,顿觉激动,在语雀这样方便的平台上编写文档,自动部署,简直爽翻,遂动手开干,花了半天的时间搞定。由于大神写的过于简略,途中遇到不少坑,遂填坑出一个完整的搭建流程

结果:

  • 我已搭建好的博客: https://rayleeafar.github.io/
  • 发布博客静态页面的仓库: https://github.com/rayleeafar/rayleeafar.github.io
  • 博客源码的仓库: https://github.com/rayleeafar/rayleeafar-blog

有问题可以参考源码里面的配置

搭建步骤:

一、GitHub pages + Hexo 搭建初级个人博客

参考文章:

  • 初始化GitHub pages: https://pages.github.com/
  • 安装hexo及相关依赖: https://hexo.io/zh-cn/docs/
  • 在第一步的GH-pages仓库目录中初始化hexo: https://hexo.io/zh-cn/docs/setup
  • 开始写作: https://hexo.io/zh-cn/docs/writing
  • 部署到github pages: https://hexo.io/zh-cn/docs/deployment

二、GitHub pages + Hexo + travis-ci 搭建中级 CI自动部署博客

主要步骤参考: https://segmentfault.com/a/1190000004667156#articleHeader1
其中需要注意的几点是:

  • 文章需要安装Ruby,才能使用gem 安装travis工具

    1
    2
    sudo apt install ruby
    gem install travis
  • 生成ssh-key的过程有点问题,按照文章ci部署的时候会报错 vi undefine,正确步骤是用以下命令登录

    1
    2
    3
    4
    5
    6
    cd path/to/your/repo/.travis
    ssh-keygen -t rsa -C "youremail@example.com"
    travis login --pro #用github账号登录
    travis encrypt-file id_rsa --pro
    #得到 openssl aes-256-cbc -K $encrypted_xxxxxxxxxxx_key -iv $encrypted_xxxxxxxxxxx_iv
    #其中 id_rsa.enc的位置需要注意设置对

注意以上两个点,按照文章步骤申请travis账号开通repo权限就能完成部署了

三、GitHub pages + Hexo + travis-ci + YuQue + Serverless搭建高级 云端写作->自动部署博客

步骤参考文章:

  • https://segmentfault.com/a/1190000017797561

按照大神的文章走,主要注意以下几点,找到并设置对各个参数

  • YuQue-hexo库的使用 https://github.com/x-cold/yuque-hexo
  • 修改package.json,增加配置:
1
2
3
4
5
6
7
8
9
10
11
12
"yuqueConfig": {
"baseUrl": "https://www.yuque.com/api/v2",
"login": "rayleeafar",#填写你的语雀账号名称
"repo": "gg272k",#填写在语雀上创建的文章仓库的编号一般是几个字母数字,你也可以自己改,下图中路径最后的那个值
"mdNameFormat": "title",
"postPath": "source/_posts/yuque"
},
"scripts": {
"sync": "yuque-hexo sync",
"clean:yuque": "yuque-hexo clean",
"deploy": "npm run sync && hexo clean && hexo g -d",
}
  • Screenshot from 2019-01-17 13-55-04.png

    * serverless 函数中参数的设置:

    文章中说用postman发个请求,也可以用curl:
    再返回的数据中找到repo的id,我的是:7596310

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    >> curl -H "Travis-API-Version: 3" -H "User-Agent: API Explorer" \ -H "Authorization: token <your_token>" \ https://api.travis-ci.org/owner/<your_name>/repos
    #curl的返回信息
    ......
    "repositories": [
    {
    "@type": "repository",
    "@href": "/repo/7596310",
    "@representation": "standard",
    "@permissions": {
    "read": true,
    "migrate": true,
    "star": true,
    "unstar": true,
    "create_cron": true,
    "create_env_var": true,
    "create_key_pair": true,
    "delete_key_pair": true,
    "create_request": true,
    "admin": true,
    "activate": true,
    "deactivate": true
    },
    "id": 7596310,
    "name": "rayleeafar-blog",
    "slug": "rayleeafar/rayleeafar-blog",
    "description": null,
    "github_id": 166050465,
    "github_language": null,
    "active": true,
    "private": false,
    "owner": {
    "@type": "user",
    "id": 1254643,
    "login": "rayleeafar",
    "@href": "/user/1254643"
    },
    ......
  • 我申请的是腾讯的serverless服务,在腾讯云上注册登录,创建函数服务:

    用下面这个函数,作者的那个里面 有个接口地址有点不同,我抓travis看到接口URL是另一个:

    curl_setopt($curl, CURLOPT_URL, ‘https://api.travis-ci.com/repo/‘.$repos.’/requests’);

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
function main_handler($event, $context) {
// 解析语雀post的数据
$update_title = '';
if($event->body){
$yuque_data= json_decode($event->body);
$update_title .= $yuque_data->data->title;
}
// default params
$repos = '7596310'; // 你的仓库id 或 slug
$token = 'yJsKEMoSNUmQSv9kLFsbvg'; // 你的登录token
$message = date("Y/m/d").':yuque update:'.$update_title;
$branch = 'master';
// post params
$queryString = $event->queryString;
$q_token = $queryString->token ? $queryString->token : $token;
$q_repos = $queryString->repos ? $queryString->repos : $repos;
$q_message = $queryString->message ? $queryString->message : $message;
$q_branch = $queryString->branch ? $queryString->branch : 'master';
echo($q_token);
echo('===');
echo ($q_repos);
echo ('===');
echo ($q_message);
echo ('===');
echo ($q_branch);
echo ('===');
//request travis ci
$res_info = triggerTravisCI($q_repos, $q_token, $q_message, $q_branch);

$res_code = 0;
$res_message = '未知';
if($res_info['http_code']){
$res_code = $res_info['http_code'];
switch($res_info['http_code']){
case 200:
case 202:
$res_message = 'success';
break;
default:
$res_message = 'faild';
break;
}
}
$res = array(
'status'=>$res_code,
'message'=>$res_message
);
return $res;
}

/*
* @description travis api , trigger a build
* @param $repos string 仓库ID、slug
* @param $token string 登录验证token
* @param $message string 触发信息
* @param $branch string 分支
* @return $info array 回包信息
*/
function triggerTravisCI ($repos, $token, $message='yuque update', $branch='master') {
//初始化
$curl = curl_init();
//设置抓取的url https://api.travis-ci.com/repo/7596310/requests
curl_setopt($curl, CURLOPT_URL, 'https://api.travis-ci.com/repo/'.$repos.'/requests');
//设置获取的信息以文件流的形式返回,而不是直接输出。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//设置post方式提交
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
//设置post数据
$post_data = json_encode(array(
"request"=> array(
"message"=>$message,
"branch"=>$branch
)
));
$header = array(
'Content-Type: application/json',
'Travis-API-Version: 3',
'Authorization:token '.$token,
'Content-Length:' . strlen($post_data)
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
//执行命令
$data = curl_exec($curl);
$info = curl_getinfo($curl);
//关闭URL请求
curl_close($curl);
return $info;
}
?>
  • 按照文章的步骤创建并填对参数应该就事成一大半了

后记

按照上述文章及注意的点走完,试试在语雀上写个文章并发布,登录serverless看看hook有没有触发,登录travis-ci看看构建是否成功,有问题留言联系呀~~
祝各位写作愉快~~~~~

Ray Lee

8 posts
RSS
© 2019 Ray Lee
Powered by Hexo
|
Theme — NexT.Pisces v5.1.4