MAC

Multiple Access Control.


  • Home

  • Categories

  • Archives

  • Tags

  • About

  • Search

mycncart email设置

Posted on 2017-11-25 | Edited on 2019-11-03 | In PHP

知识点:查看log

提交订单时,出现服务器500错误,但是php的相关报错都已经打开。
想了一会,还是看fpm_error.log和nginx errorlog

Read more »

C语言str_reverse实例

Posted on 2017-11-25 | Edited on 2019-11-03 | In C

知识点:

字符数组的字符串指针反转

Read more »

C语言STRSTR实例

Posted on 2017-11-25 | Edited on 2019-11-03 | In C

知识点:

strstr()函数会在第一个字符串中查找第二个字符串,如果找到,他会返回第二个字符串在存储器中的位置。

Read more »

redis竟态与争抢唯一

Posted on 2017-11-22 | Edited on 2019-11-03 | In REDIS

incr

比如北京车牌采取先抢到后审批资质的流程。车牌池子中有N多号码,页面呈现以一页十条的方式展示,每个号码后有一个抢的按钮,且一个人只能抢一个车牌,同样一个车牌只能被一个人抢到。业务模型参考

Read more »

字符指针与字符数组

Posted on 2017-11-20 | Edited on 2019-11-03 | In C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int main()
{
char masked_raider[] = "Alived";
char *jimmy = masked_raider;
printf("masked_raider is %s,jimmy is %s\n", masked_raider, jimmy);
masked_raider[0] = 'd';
masked_raider[1] = 'e';
masked_raider[2] = 'a';
masked_raider[3] = 'd';
masked_raider[4] = 'e';
masked_raider[5] = 'd';
printf("masked_raider is %s,jimmy is %s\n", masked_raider, jimmy);
return 0;
}
Read more »

php捕获fatal error

Posted on 2017-11-17 | Edited on 2019-11-03 | In PHP

用到laravel定时任务的时候,由于类似conf配置问题,无法捕捉到错误,采取的方式如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
function fatal_handler() {
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if($error){
//发送邮件队列也可以
file_put_contents('./testerror11.txt', json_encode($error));
}
}
register_shutdown_function("fatal_handler");
try{
$db=new db();
}catch(Exception $e){
echo $e->error_msg();
}

字符数组+1与指针+1

Posted on 2017-11-04 | Edited on 2019-11-03 | In C

字符数组+1代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
int main(){
char mystr[]="Abcef";
printf("size of mystr=%i\n",sizeof(mystr));
printf("mystr[0],他的值为%c:\n",mystr[0]);
printf("&mystr[0],他的内存地址值为%i:\n",&mystr);
printf("mystr[1],他的值为%c:\n",mystr[1]);
printf("&mystr[1],他的内存地址值为%i:\n",&mystr+1);
printf("mystr[2],他的值为%c:\n",mystr[2]);
printf("&mystr[2],他的内存地址值为%i:\n",&mystr+2);
printf("mystr[3],他的值为%c:\n",mystr[3]);
printf("&mystr[3],他的内存地址值为%i:\n",&mystr+3);
return 0;
}
Read more »

计算机科学CS分类

Posted on 2017-11-04 | Edited on 2019-11-03 | In computer

经常看到CS这个词,今天偶然下载了知乎刘洋的电子书。再此也敲一下。

理论计算机科学

数据结构和算法

计算理论

信息论与编码理论

编程语言与编译器

形式化方法

Read more »

根据当前日期算出N个工作日之后的日期

Posted on 2017-05-31 | Edited on 2019-11-03 | In PHP

需求:给定一个日期,要求算出N天(工作日)后的日期


Read more »

HTTP-CAHCE中的CACHE-CONTROL、Etag、Modify

Posted on 2017-03-07 | Edited on 2019-11-03 | In PHP

用世界上最好的语言演示一下etag

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
// apache 服务器,如果您是nginx请自行配置读取header等信息,同时下面会有nginx测试
$file = 'etag.txt';
$etag = md5_file($file);
$headers = apache_request_headers();
if (isset($headers['If-None-Match']) && trim($headers["If-None-Match"]) == $etag) {
header("HTTP/1.1 304 Not Modified");
} else {
$content = file_get_contents($file);
header("Etag: $etag");
echo $content;
}

第一次请求,服务器返回200.我分别列下请求头【RequsetHeaders】和响应头【ResponseHeaders】

请求头

1
2
3
4
5
6
7
8
9
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:zh-CN,zh;q=0.8,en;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Host:kache.com
Pragma:no-cache
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.

Read more »
1234
Tong Bo

Tong Bo

君子曰:学不可以已。吾尝终日而思矣,不如须臾之所学也;吾尝跂而望矣,不如登高之博见也。登高而招,臂非加长也,而见者远;顺风而呼,声非加疾也,而闻者彰。假舆马者,非利足也,而致千里;假舟楫者,非能水也,而绝江河。君子生非异也,善假于物也。

37 posts
11 categories
60 tags
GitHub E-Mail Segmentfault
© 2019 Tong Bo
Powered by Hexo v3.3.1
|
Theme – NexT.Muse v6.4.0