如果网站主页使用了支持随机调用文章的CMS,如:dedecms,内容又是采集的,并且你没多少时间进行手动更新内容的话,但又想让百度喜欢你的网站,用这个小程序将会对你相当的有用和方便。
代码如下:
< ?php
set_time_limit(0);
//你网站的CMS根网址,结束不要加 /
$baseCmsUrl = "http://www.examx.cn";
//动态主页的名称
$dmPageName = "index.php";
//静态主页的名称
$stPageName = "index.html";
//你希望多长时间更新一次,单位是秒
$mkTime = 3600;
//下面是执行的代码
$tureStFile = dirname(__FILE__)./.$stPageName;
$ftime = @filemtime($tureStFile);
if(!file_exists($tureStFile) || ($ftime < time()-$mkTime))
{
$body = file_get_contents($baseCmsUrl./.$dmPageName);
$fp = fopen($tureStFile, w);
fwrite($fp, $body);
fclose($fp);
}
?>
将上述代码保存为 task.php
然后在主页的静态HTML结尾引入下面的JS
<脚本 language=java脚本 src=task.php></脚本>
尚未测试转自百度
[field:id runphp="yes"]
$dsql = new DedeSql(false);
$a=”SELECT xiaoyu.renshu FROM dede_addonzhaopin as xiaoyu where xiaoyu.aid=@me”;
$arcRow = $dsql->GetOne($a);
@me=”.$arcRow[renshu].”;
[/field:id]
忘记是谁说的了..好早以前保存的.记录下..有很多小东西都没有放到博客上
function='str_replace("index.html","",@me)'
加在标签中使用
水印无限长
水印边距0
image.class.php文件
加水印的条件,必须是
$wmwidth = $imagewidth – $logowidth;
$wmheight = $imageheight – $logoheight;
$wmwidth > 10
$wmheight > 10
$imagewidth – $logowidth;
图片宽度减去水印宽度 意思是,图片必须得比水印大10像素,才能加上水印
if(($this->watermarktype < 2 && is_readable($watermark_file) || $this->watermarktype == 2) && $wmwidth > 10 && $wmheight > 10 && !$this->animatedgif)
删除&& $wmwidth > 10 && $wmheight > 10即可
MJJ天工提供教程
[field:pubdate runphp='yes']
$a="<font color=’#ff0000′>";
$d="<font color=’#858585′>";
$b="</font>";
$c=strftime("%m月%d日","@me");
$ntime = time();
$oneday = 3600 * 24;
if(($ntime – @me)<$oneday) @me = $a.$c.$b;
else @me = $d.$c.$b;
[/field:pubdate]