|
復(fù)制代碼 代碼如下:
function highlight($sString, $aWords) {
if (!is_array ($aWords) || empty ($aWords) || !is_string ($sString)) {
return false;
}
$sWords = implode ('|', $aWords);
return preg_replace ('@/b('.$sWords.')/b@si', '<strong style="background-color:yellow">$1</strong>', $sString);
}
獲取你的Feedburner的用戶
復(fù)制代碼 代碼如下:
function get_average_readers($feed_id,$interval = 7){
$today = date('Y-m-d', strtotime("now"));
$ago = date('Y-m-d', strtotime("-".$interval." days"));
$feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$ago.",".$today;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $feed_url);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
$nb = 0;
foreach($xml->feed->children() as $circ){
$nb += $circ['circulation'];
}
return round($nb/$interval);
}
自動(dòng)生成密碼
復(fù)制代碼 代碼如下:
function generatePassword($length=9, $strength=0) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength >= 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength >= 2) {
$vowels .= "AEUY";
}
if ($strength >= 4) {
$consonants .= '23456789';
}
if ($strength >= 8 ) {
$vowels .= '@#$%';
}
$password = '';
$alt = time() % 2;
for ($i = 0; $i < $length; $i++) {
if ($alt == 1) {
$password .= $consonants[(rand() % strlen($consonants))];
$alt = 0;
} else {
$password .= $vowels[(rand() % strlen($vowels))];
$alt = 1;
}
}
return $password;
}
壓縮多個(gè)CSS文件
復(fù)制代碼 代碼如下:
header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
/* remove comments */
$buffer = preg_replace('!//*[^*]*/*+([^/][^*]*/*+)*/!', '', $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("/r/n", "/r", "/n", "/t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
/* your css files */
include('master.css');
include('typography.css');
include('grid.css');
include('print.css');
include('handheld.css');
ob_end_flush();
獲取短網(wǎng)址
復(fù)制代碼 代碼如下:
function getTinyUrl($url) {
return file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
}
根據(jù)生日計(jì)算年齡
復(fù)制代碼 代碼如下:
function age($date){
$year_diff = '';
$time = strtotime($date);
if(FALSE === $time){
return '';
}
$date = date('Y-m-d', $time);
list($year,$month,$day) = explode("-",$date);
$year_diff = date("Y") 主站蜘蛛池模板: 亚洲AV无码乱码国产麻豆P | 乱爱性全过程免费视频 | 午夜想想爱 | 全黄H全肉细节文短篇 | 老师小扫货水能么多叫出来 | 3dbdsm变态videos高清 | SM脚奴调教丨踩踏贱奴 | WWW久久只有这里有精品 | 永久精品免费影院在线观看网站 | 亚洲精品天堂自在久久77 | 国产亚洲精品第一区香蕉 | 国拍在线精品视频免费观看 | 欧美成人亚洲高清在线观看 | 久久九九亚洲精品 | 不戴套挺进人妻怀孕 | 男女做爽爽爽视频免费软件 | 国产成人高清精品免费5388密 | 亚洲青青青网伊人精品 | www.精品视频 | 色橹橹欧美在线观看视频高清 | 亚洲精品成人A8198A片漫画 | 无码11久岁箩筣 | 男人J放进女人P全黄网站 | 久草在线在线精品观看99 | 国产精品成人啪精品视频免费观看 | 国产免费久久爱久久啪 | 国产一区日韩二区欧美三区 | 亚洲国产中文字幕在线视频综合 | 国产在线精品亚洲另类 | 欧美成人免费观看久久 | 在线 自拍 综合 亚洲 欧美 | 草莓视频在线观看免费观看高清 | 日本xxxxxx片免费播放18 | 最新高清无码专区在线视频 | 伦理片飘花免费影院 | a毛片基地免费全部视频 | 国产成人精视频在线观看免费 | 国家产午夜精品无人区 | 国产午夜精品视频在线播放 | 久久精品熟一区二区三区 | 丁香美女社区 |