Skip to content

Instantly share code, notes, and snippets.

View zhoumengkang's full-sized avatar
🤒
Out sick

周梦康 zhoumengkang

🤒
Out sick
View GitHub Profile
@zhoumengkang
zhoumengkang / saveforword.php
Last active December 17, 2015 06:09
PHP下载网页内容保存为word
header('content-type:charset=utf-8');
header("Content-Type:application/msword");
header("Content-Disposition:attachment;filename={$_GET['type']}.doc");
header("Pragma:no-cache");
header("Expires:0");
echo $_GET['content'];
@zhoumengkang
zhoumengkang / geturl.php
Created May 12, 2013 12:57
PHP获取当前页面的完整地址
$row['url'] = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
@zhoumengkang
zhoumengkang / xxtest.html
Created May 13, 2013 06:22
test_5.13.html
<a href="png" alt=""/></a>
@zhoumengkang
zhoumengkang / maybe.html
Created May 13, 2013 10:27
yes ,that's right!
<p>maybe</p>
表还是原来的5张表:
group、user、role、access、node,做的改动是node表增加了一个字段filter_field,用来规定该操作是否要根据角色来过滤字段,可以在节点管理里添加该限制。
access表里增加了一个fields字段,存放该角色在该节点上可以操作的字段列表,可以在后台的授权操作中来设置该列表。
比如,
node表有一个显示订单列表的操作index:
node_id title filter_field
83 列表 1
@zhoumengkang
zhoumengkang / getcontent.php
Last active December 17, 2015 14:39
把查询出来的数据还原为关联形式的树形结构展示
<?php
include '../../nb.php';
include '../../config.php';
include 'config.php';
include 'do.php';
$db=\publish\obj::db();
$year = $_GET['year'];
$sql = 'select a.year,a.guid,a.description,b.description as pic_des,c.year as pic_year ,c.month as pic_month,c.day as pic_day,c.file as pic_file from m_honor2_honor2 a, m_honor2_pics b, sys_file c where a.year = '.$year.' and b.honor2_guid = a.guid and b.image= c.guid order by a.order_is asc';
@zhoumengkang
zhoumengkang / formattree.php
Created May 23, 2013 06:35
formattree 无限分类
<?php
/*
* Format Tree
**/
class FORMATTREE
{
function formatTree($arr,$child_key='id',$parent_key='parent_id') {
$tree = array();
foreach ($arr as $val) {
if ( isset($arr[$val[$parent_key]]) ) {
# -*- coding:utf-8 -*-
'写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码'
'搜狗词库下载地址:http://vdisk.weibo.com/s/7RlE5'
import string
__dict = {}
def load_dict(dict_file='words.dic'):
'加载词库,把词库加载成一个key为首字符,value为相关词的列表的字典'
// 朋友分享的闭包的坑,我保存一份学习
// closure caveat
// case 1
;(function (window, $, undefined) {
var $target;
function howdy() {
var x = 'foo';
<script type="text/javascript" src="{:THEME_PUBLIC_URL}/js/jquery.js"></script>
<form action="{:U('news/Index/doJoin')}" method="post" name="join">
<input type="text" name="username" id="username" ><span class="username"></span>
<input type="email" name="email" id="email"><span class="email"></span>
<input type="text" name="company" id="company"><span class="company"></span>
<input type="text" name="job" id="job"><span class="job"></span>
<input type="text" name="tel" id="tel"><span class="tel"></span>
<input type="text" name="qq" id="qq"><span class="qq"></span>
<input type="text" name="weixin" id="weixin">
<input type="text" name="verify" id="verify"><img src="__ROOT__/public/captcha.php" id="verifyimg" alt="{:L('PUBLIC_CHANGE_ONE')}" style="vertical-align:middle;padding:0 5px 0 0" onclick="changeverify()"/></div>