Skip to content

Instantly share code, notes, and snippets.

View guweigang's full-sized avatar

南無假行僧 guweigang

View GitHub Profile
<?php
/**
* 微信PHP-SDK
* 服务器端必须要有 CURL 支持
* 2015年7月修正版本
* @author 、小陈叔叔 <cjango@163.com>
* https://coding.net/u/cjango/p/wechat_sdk/git
* 7月10日,完善红包功能,
*/
namespace Tools;
<?php
ini_set("memory_limit", "4G");
/**
* @param string $input
*/
function invoke($input)
{
$bootstrap = new \PhalconPlus\Bootstrap(dirname(dirname(__DIR__)));
$di = new \Phalcon\DI\FactoryDefault\CLI();
<?php
public function createPdf()
{
$this->view->disable();
$userId = $this->request->getPost('bbb');
$rez['rez'] = Users::findFirstById($userId)
$html = $this->view->getRender('reports', 'pdf_report', $rez);
<?php
$redirect_stdout = false;
$workers = [];
$worker_num = 8;
//swoole_process::daemon(0, 1);
for($i = 0; $i < $worker_num; $i++)
{
$process = new swoole_process('child_async', $redirect_stdout);
$pid = $process->start();
@guweigang
guweigang / bullsoft_php.h
Created May 20, 2015 09:08
bullsoft header file for php-ext
#ifndef BULLSOFT_PHP_H
#define BULLSOFT_PHP_H
#ifndef PHP_FE_END
#define PHP_FE_END { NULL, NULL, NULL, 0, 0 }
#endif
#ifndef ZEND_MOD_END
#define ZEND_MOD_END { NULL, NULL, NULL, 0 }
#endif
<?php
namespace NCFGroup\Common\Library;
/**
* AES对称加密封装 (包括base64)
* 算法: AES128位
* 模式: ECB
* 填充: PKCS5Padding
*/
package main
import (
"io"
"log"
"net"
"bytes"
"bufio"
"strings"
"time"
#!/bin/bash
# mysql 自动备份
TIMESTAMP=$(date +"%Y%m%d")
BACKUP_DIR="/usr/local/mysql/backup"
MYSQL_USER="root"
MYSQL=/usr/local/mysql/bin/mysql
MYSQL_PASSWORD="root"
MYSQLDUMP=/usr/local/mysql/bin/mysqldump
<?php
use
Phalcon\Mvc\Model,
Phalcon\Mvc\Model\Message,
Phalcon\Db\RawValue;
/**
* 基础 Model 实现
*
@guweigang
guweigang / comma.php
Created June 30, 2014 12:55
全角转半角
<?php
$str = "0123ABCDFWS\",.?<>{}[]*&^%#@!~()+-|:;";
echo "$str";
echo "<br />";
$str = preg_replace('/\xa3([\xa1-\xfe])/e', 'chr(ord(\1)-0x80)', $str);
echo $str;