Skip to content

Instantly share code, notes, and snippets.

View coder-liyang's full-sized avatar

Yang Li coder-liyang

View GitHub Profile
This file has been truncated, but you can view the full file.
<!--?xml version="1.0" encoding="utf-8"?-->
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><plugins>
<cachechk>201607221201</cachechk>
<item>
<name>iPerf3</name>
<internalname>iPerf3</internalname>
<changelog>https://www.qnapclub.eu/en/qpkg/releasenotes/180</changelog>
<category>QnapClub</category>
/**
* 找到一定范围内的质数/素数
* @param int $max 质数范围
* @return array
*/
function primeNumber($max)
{
$max = (int)$max;
$result = array();
$i = 1;
@coder-liyang
coder-liyang / permutation_combination.php
Last active December 19, 2016 09:59
排列&&组合算法
<?php
/**
* 排列的总个数
* @param int $n
* @param int $m
* @return int
*/
function a($n, $m){
if($n < $m) return false;
$num = 1;
@coder-liyang
coder-liyang / getMobileType.php
Created November 7, 2016 07:32
判断手机号的运营商
/**
* 判断手机号的类型
* 更新时间 2016-11-07
* @param $mobile
* @return int 1:电信 2:移动 3:联通 4:虚拟运营商 10:未知
*/
function getMobileType($mobile){
$prefix = substr($mobile,0,3);
if (in_array($prefix, array('133','153','154','181','180','189','177'))) {
return 1;
@coder-liyang
coder-liyang / dict.php
Created October 17, 2016 08:09
生成数据字典
<?php
/**
* 生成mysql数据字典
*/
//配置数据库
$dbserver = "127.0.0.1";
$dbusername = "用户名";
$dbpassword = "密码";
$database = "数据库名";
$prefix = "前缀";
@coder-liyang
coder-liyang / gist:4c31788ed89344e16fdc0cc997db4203
Created August 17, 2016 17:01
如何获取 YII2 AR 执行的 SQL 语句,直接用程序输出,而不是通过日志去查看
$query = User::find()
->where(['id'=>[1,2,3,4])
->select(['username'])
// get the AR raw sql in YII2
$commandQuery = clone $query;
echo $commandQuery->createCommand()->getRawSql();
$users = $query->all();