摘要: http://www.superman2014.com 欢迎光顾 本博客不在更新!!!! 阅读全文
posted @ 2015-08-20 09:08 Martin2 阅读(226) 评论(1) 推荐(0) 编辑
摘要: 目前,比较流行的分表为2倍扩容。 表A(id, name, age, sex) 基于自增id分表, 通过触发器先同步A到B, 程序通过mod 2操作数据,然后drop掉触发器,在 删除两个A表的偶数id, B表的奇数id。在alter table A engine=InnoDB;去除索引碎片。依次类 阅读全文
posted @ 2015-08-18 11:33 Martin2 阅读(661) 评论(0) 推荐(0) 编辑
摘要: 1 需要把上面这段html中的图片网址,上传到自己的服务器,并做好映射。提取url:preg_match_all('/]*src\s?=\s?[\'|"](?!http:\/\/img.jinyuanbao|http:\/\/img.jybtest)([^\'|"]*)[\'|"]/is', $co... 阅读全文
posted @ 2015-08-15 12:13 Martin2 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 前2天做广点通统计接口进行回调时需要加密,其中Python对字符串遍历很方便。1 s = 'abcd'2 3 for ch in s:4 print ch但是PHP我想了半天还是老样子for循环之类的:1 <?php2 $s = 'abcd';3 $l = strlen($s);4 5 fo... 阅读全文
posted @ 2015-08-14 20:51 Martin2 阅读(240) 评论(0) 推荐(0) 编辑
摘要: zip中加入文件1 open('test.zip', ZipArchive::OVERWRITE) === TRUE)4 {5 $zip->addFile('age.txt');//假设加入的文件名是age.txt,在当前路径下6 $zip->close();7 } 阅读全文
posted @ 2015-08-13 19:06 Martin2 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 测试1分钟900多个包关键思路就是读文件,如图:Python快速打包脚本: 1 #!/usr/bin/env python 2 3 import zipfile 4 5 prefix = 'channel_' 6 channel = 'jyb' 7 8 try: 9 zipped = ... 阅读全文
posted @ 2015-08-13 13:21 Martin2 阅读(389) 评论(0) 推荐(0) 编辑
摘要: #1 $_SERVER中的PHP_SELF,当前执行脚本的文件名,与 document root 有关。例如,在地址为http://example.com/test.php/foo.bar的脚本中使用$_SERVER['PHP_SELF']将得到/test.php/foo.bar。#2$_SERVE... 阅读全文
posted @ 2015-08-12 11:52 Martin2 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 本人习惯用vim编辑器,这里ctags配置vim很方便。#在ThinkPHP源码目录(假定为/server/thinkphp)执行:$ cd /server/thinkphp$ ctags -R #小技巧:在当前目录生成的tags文件中使用的是相对路径,#若改用 ctags -R /server/ ... 阅读全文
posted @ 2015-08-12 10:45 Martin2 阅读(202) 评论(0) 推荐(0) 编辑
摘要: PHP 常量PHP_SAPI具有和php_sapi_name()相同的值。1 define('IS_CGI',(0 === strpos(PHP_SAPI,'cgi') || false !== strpos(PHP_SAPI,'fcgi')) ? 1 : 0 );2 define('IS_WIN'... 阅读全文
posted @ 2015-08-11 22:20 Martin2 阅读(377) 评论(0) 推荐(0) 编辑
摘要: __DIR__, php5.3 才增加的这个魔术常量,表示当前文件所在的目录地址。php5.3之前用dirname(__FILE__);表示__DIR__;__FILE__这个表示当前文件的路径。 阅读全文
posted @ 2015-08-11 08:52 Martin2 阅读(1497) 评论(0) 推荐(0) 编辑