- 博客(9)
- 收藏
- 关注
原创 c语言简单的字符串查找
#include #include #includeint main(){ int i,j,k,TLen,PLen,count=0; char T[50],P[10]; printf("请输入两个字符串,以回车隔开,母串在前,子串在后:\n"); gets(T); gets(P); TLen=strlen(T);
2016-05-13 15:21:33
520
原创 php的strrev
strrev这个函数是反转字符串,但是有中文的时候,就不好使了。所以分享一下自己的方式,有更优的方法欢迎分享。$tmpstr = "";$str = "测试360";$len = strlen($str);for($i=$len-1; $i>0;){if(ord($str[$i]) > 127){$tmpstr .= substr($str,$i-$len-2,3)
2014-04-21 17:14:04
557
原创 php求最长回文串
php求最长回文串,源码如下:$str = "abcba123321qw";$len = strlen($str);$max = 0;$tmp = array();for($i=0; $i{//直接对称的情况for($j=0; $i-$j>=0&&$i+$j{if($str[$i-$j] != $str[$i+$j]) break;if($j*2+1
2014-04-21 17:11:25
975
原创 php闭包
php5.3引入了闭包的概念,但和javascript的闭包不同,先看示例:1、普通闭包$s = function($p){ echo $p;};$s('123');//输出1232、引用外部变量$a = 9;$b = 90;$c = function($p) use ($a,$b){ echo $p,$a+$b;};$c(9);//输出9993、回调函数
2014-04-03 11:31:15
469
转载 php一致性hash算法
/** * Flexihash - A simple consistent hashing implementation for PHP. * * The MIT License * * Copyright (c) 2008 Paul Annesley * * Permission is hereby granted, free of charge, to any
2014-01-27 16:11:24
646
原创 lighttpd+php
本文简要说明lighttpd+php安装及配置1、下载lighttpdwget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.33.tar.gz2、解压安装包至自定义目录下,安装编译tar -zxvf lighttpd-1.4.33.tar.gzcd lighttpd-1.4.33
2014-01-17 17:55:00
845
原创 awk统计独立IP
awk文件形式-----------ip.awk----------{ ip[$1]++}END { for(i in ip) { print i,ip[i] >"/tmp/ip.txt" }}awk -f ip.awk /usr/local/apach
2013-12-17 15:51:23
1234
原创 mysql-5.5安装
我的机器是centos系统下载必须安装包:wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gzwget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.33.tar.gz/from/http://cdn.mysql.com/解压上述包,先安装好c
2013-11-06 16:57:30
617
原创 跨域问题解决示例
先设hosts:127.0.0.1 www.qq.com(一)先来个jquery的//jsopnp跨域function test1(){ $.ajax({ url:'http://www.qq.com/js/jsonp.php?uid=123456', dataType:"jsonp",
2013-10-31 16:46:54
554
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人