This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compose() { | |
$funcs = func_get_args(); | |
return function ($x) use ($funcs) { | |
foreach($funcs as $func) | |
$x = $func($x); | |
return $x; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 函数名 html_substr | |
* 功能 从html串中截取指定长度的字串,html标记不计算在内 | |
* 参数 | |
* $str 要截取的串 | |
* $len 要截取的长度 | |
* $mode 不匹配的标记的处理方式 0 删去(默认),1 补齐 | |
* 返回 截取到的串 | |
* 说明 | |
* 未考虑多字节字符,仅已字节做计数单位 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo route -n add -net 192.168.6.0 -netmask 255.255.255.0 192.168.200.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkUploadText($content) | |
{ | |
$stoptext = file_get_contents($this->CI->config->item('stopword_file')); | |
$stoptext = str_replace("\n",'',$stoptext); | |
$stoptext = str_replace("\r",'',$stoptext); | |
$stopwords = array_map('strtolower',explode(',',$stoptext)); | |
$content = strtolower($content); | |
$ret = array('ret'=>1,'word'=>''); | |
if($content!='') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t' or 1=(SELECT top 1 name FROM master..sysdatabases where name not in (SELECT top 0 name FROM master..sysdatabases))-- | |
b' or 1=(SELECT top 1 name FROM master..sysobjects where xtype='U' and name not in (SELECT top 1 name FROM master..sysobjects where xtype='U'))-- | |
b' or 1=(SELECT top 1 master..syscolumns.name FROM master..syscolumns, master..sysobjects WHERE master..syscolumns.id=master..sysobjects.id AND master..sysobjects.name='spt_fallback_db'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -p parameter tells wget to include all files, including images. | |
# -e robots=off you don't want wget to obey by the robots.txt file | |
# -U mozilla as your browsers identity. | |
# --random-wait to let wget chose a random number of seconds to wait, avoid get into black list. | |
# Other Useful wget Parameters: | |
# --limit-rate=20k limits the rate at which it downloads files. | |
# -b continues wget after logging out. | |
# -o $HOME/wget_log.txt logs the output | |
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(-1); | |
$parent_nodes = array(); | |
$html = file_get_contents("http://www.csdn.net/article/2013-01-09/2813524-CSDN-morning-paper"); | |
$doc = new DOMDocument(); | |
$doc->encoding = "utf-8"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
mysql_connect(); | |
//测试数据 | |
$sql =<<< SQL | |
select * from ( | |
select '1' as id, '0' as pid, 'Food' as title | |
union all select '2', '1', 'Fruit' | |
union all select '3', '2', 'Red' | |
union all select '4', '3', 'Cherry' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists('http_get_utf8_html')) | |
{ | |
function http_get_utf8_html($url,$from_encoding='') | |
{ | |
$result = array(); | |
$result['url'] = $url; | |
$result['html'] = ''; | |
$header = get_headers_by_curl($url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
获取http响应的头信息 | |
parameter: | |
$url : the target url | |
$formate: if non-zero,function parses the response and sets the array's keys | |
return : | |
array | |
return example: |