原创 記一次網站被黑經歷

問題原由 早上突然接到客戶電話,網站在微信中無法打開,被微信攔截 在pc端訪問網站,點擊首頁中任何一個url都會跳轉到第三方網站,恍然大悟,網站是被黑了 問題分析 發現網站head被加入一下代碼 發現js裏面代碼的如下,會強制跳轉到第三方網

原创 使用Jekyll搭建博客

由於Jekyll 可以放到github訪問,所以用Jekyll的用戶很多在本地搭建環境,查看效果 1.安裝rbenvbrew install rbenvrbenv init按照提示進行操作echo 'eval "$(rbenv init -

原创 php 數據過濾

在對用戶輸入數據進行過濾時通常都是自己寫方法進行判斷比如驗證郵箱的時候使用正則表達式 $pattern = "/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/"; if (!preg_match

原创 logstash

logstash文檔地址: https://www.elastic.co/guide/en/logstash/index.html logstash 命令 接收輸入並輸出 logstash -e 'input { stdin { } }

原创 記一次php curl導致的故障

情景描述 本地和alpha環境curl請求第三方接口正常beta環境curl請求失敗 代碼如下 public static function getCurl($url, $type = 'get', $data = '', $decod

原创 php導致內存溢出

在執行一個導出csv腳步時,當要導出的數據超過3w多條時,就會報錯,如下: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

原创 php 數據過濾

在對用戶輸入數據進行過濾時通常都是自己寫方法進行判斷比如驗證郵箱的時候使用正則表達式 $pattern = "/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/"; if (!preg_match

原创 elasticsearch 的使用

ElasticSearch是什麼? ElasticSearch是一個基於Lucene的搜索服務器。它提供了一個分佈式多用戶能力的全文搜索引擎,基於RESTful web接口。Elasticsearch是用Java開發的,並作爲Apache

原创 logstash

logstash文檔地址: https://www.elastic.co/guide/en/logstash/index.html logstash 命令 接收輸入並輸出 logstash -e 'input { stdin { } }

原创 thinkphp3.2 comon目錄下function.php 中方法找不到bug

thinkphp3.2版本中問題描述:在了comon目錄下function.php中新增了方法在alpha環境中正常在product環境中報錯找不到新增的方法 原因:在debug=false時,需要清空Runtime文件

原创 go 錯誤處理panic recover

當程序遇到致命錯誤時,就是停止運行Go 通過panic函數來報告致命錯誤 func testError1() { panic(errors.New("this is a error")) } 代碼執行中出現錯誤比如數組越界

原创 go 延遲函數 defer

defer 語句用於延遲調用指定的函數比如: func outerFunc() { defer fmt.Println("defer 執行") fmt.Println("第一個被打印") } defer 語句最後纔會被執

原创 web自動化爬蟲selenium centos 無GUI環境配置

基本環境:centos7,python3.x1.安裝seleniumpip3 install selenium2.安裝chrome-browserwget https://dl.google.com/linux/direct/google-

原创 php 計算下個月

在使用如下方法計算當前日期以後的6個月的時候發現了問題 for($i = 0;$i<6;$i++){ echo date('Y-m-d', mktime(0, 0, 0, intval(date('m'))+$i, date('d'