简单查询团队
public function myteamsrenyuans($uid, $ids='')
{
$back = Db::name('user')->field('uid')->where('pid',$uid)->select()->toarray();
if (!empty($back) && is_array($back)) {
foreach ($back as $v) {
//防止当前人的ID重复去查询,形成恶性循环
if ($v['uid'] == $uid) {
continue;
}
$back2 =Db::name('user')->where('pid',$v['uid'])->count('uid');
if ($back2 > 0) {
$ids = $this->myteamsrenyuans($v['uid'],$ids);
} else {
$ids .= ','.$v['uid'];
}
}
}
$ids = $uid.','.$ids.',';
$ids = str_replace(',,', ",", $ids);
$ids = trim($ids, ',');
return $ids;
}
颜色选择器
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/bootstrap-colorpicker/3.0.0-beta.1/js/bootstrap-colorpicker.min.js"></script>
<link href="https://cdn.bootcss.com/bootstrap-colorpicker/3.0.0-beta.1/css/bootstrap-colorpicker.min.css" rel="stylesheet">
<form class="form-inline col-md-2">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">请选择颜色</div>
<input type="text" class="form-control" id="color" placeholder="#000000">
</div>
</div>
</form>
<script>
$(function() {
$('#color').colorpicker({
allowEmpty:true,//允许为空,显示清楚颜色按钮
color: "#ffffff",//初始化颜色
showInput: true,//显示输入
containerClassName: "full-spectrum",
showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
showPalette: true,//显示选择器面板
showSelectionPalette: true,//记住选择过的颜色
showAlpha: true,//显示透明度选择
maxPaletteSize: 7,//记住选择过的颜色的最大数量
preferredFormat: "hex"//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原
});
});
</script>
redis-linux简单命令
进入目录dbsize->
keys *
flushall
./redis-cli 进入
简单的work秒级任务
class Mail
{
public static $db = null;
public function send($to, $content)
{
$muinfos=self::$db = new \Workerman\MySQL\Connection('127.0.0.1', '3306', 'root', 'r7pe4zq9a4zasd', 'root');
$time=time();
self::$db->query("UPDATE `test` SET `title` = $time WHERE (id = 1 )");
}
}
$task->onWorkerStart = function($task)
{
$mail = new Mail();
$to = 'workerman@workerman.net';
$content = 'hello workerman';
Timer::add(1, array($mail, 'send'), array($to, $content));
};