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语言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 123456789101112131415161718int 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配置问题,无法捕捉到错误,采取的方式如下 1234567891011121314151617181920212223<?phpfunction 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代码123456789101112131415161718192021#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 用世界上最好的语言演示一下etag123456789101112131415<?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】 请求头123456789Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Encoding:gzip, deflate, sdchAccept-Language:zh-CN,zh;q=0.8,en;q=0.6Cache-Control:no-cacheConnection:keep-aliveHost:kache.comPragma:no-cacheUpgrade-Insecure-Requests:1User-Agent:Mozilla/5. Read more »