Skip to content

Instantly share code, notes, and snippets.

View forecho's full-sized avatar
🎯
Focusing

蔡正海 forecho

🎯
Focusing
View GitHub Profile
@forecho
forecho / WxMockLogin.php
Created December 23, 2013 07:28
微信公众平台模拟登录
<?php
/**
*微信公众平台模拟登录
*
*实现了公众平台上的操作<br>包括 实时消息获取 快速回复 用户管理 群发消息 获取用户基本信息
*@copyright Copyright info
*@author dml
*@version version
*@package defalut
*/
@forecho
forecho / test-graph-abi.json
Last active May 17, 2023 10:24
test-graph-abi.json
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
@forecho
forecho / Model.php
Last active July 15, 2022 11:23
Yii 2 表单验证JSON 二维数据
/**k
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'subtitle'], 'string', 'max' => 100],
['productInfo', 'vaildateProductInfo'], // 自定义验证
['skus', 'vaildateSkus'], // 自定义验证
];
@forecho
forecho / controller.php
Last active July 15, 2022 11:20
Yii2 使用 CoreSeek 搜索 Demo 更多信息参考官方文档 http://www.coreseek.cn/products-install/step_by_step/
public function actionSearch()
{
$keyword = Yii::$app->request->get('keyword');
if (empty($keyword)) $this->goHome();
require_once(Yii::getAlias('@common/helpers') . '/sphinxapi.php');
$cl = new \SphinxClient ();
$cl->SetServer('127.0.0.1', 9312);
//以下设置用于返回数组形式的结果
$cl->SetArrayResult(true);
@forecho
forecho / tree.php
Last active July 15, 2022 11:15
PHP 递归方法实现无限分类两种实例
<?php
/**
* @link http://ideone.com/gAsKlI
*/
$items = array(
array('id' => 1, 'pid' => 0, 'name' => '一级11'),
array('id' => 11, 'pid' => 0, 'name' => 'www.111cn.net 一级12'),
array('id' => 2, 'pid' => 1, 'name' => '二级21'),
array('id' => 10, 'pid' => 11, 'name' => '二级22'),
array('id' => 3, 'pid' => 1, 'name' => '二级23'),
@forecho
forecho / SearchModel.php
Last active July 15, 2022 11:14
Yii2 Search Model
<?php
/**
* author : forecho <caizhenghai@gmail.com>
* createTime : 2015/12/29 15:33
* description:
*/
namespace common\components;
use yii\base\InvalidParamException;
@forecho
forecho / wsj.user.js
Created December 24, 2021 09:58
Wall Street Journal Paywall bypass
/* jshint esversion: 6 */
// ==UserScript==
// @name WSJ and Barrons Paywall Hack
// @include https://*.wsj.com/*
// @include https://*.barrons.com/*
// @run-at document-end
// @grant none
// @version 2
// ==/UserScript==
@forecho
forecho / php.md
Last active September 28, 2021 07:06
PHP程序员简历模板
@forecho
forecho / github-action.yml
Created March 17, 2020 07:45
GitHub Action 部署示例
name: PHP Composer
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
<?php
/**
* author : forecho <caizhenghai@gmail.com>
* createTime : 2016/3/30 16:47
* description:
*/
namespace common\helpers;
class StringHelper