Discuz XCache 安装配置
作者:野风信子 日期:2012-05-10
XCache是一种新的php缓存器,经过测试,在Windows下效果比同类软件强很多。本文以Win2003 + IIS6下安装XCache加速Discuz为例。
实际测试效果如下(非科学方法):
原网页平均执行时间:0.13 秒
加速后网页平均执行时间:0.03秒
原CPU占用率:15% - 60%
加速后CPU占用率:3% - 30%
可以看出,使用这个加速器可以很大程度的降低CPU占用(但会造成更多的内存占用),并使网页执行时间缩短。具体原理不介绍了,网上有很多。
由于其他同类软件对Windows的支持不够好,所以选用XCache是Windows主机的不二之选。
解压Xcache,把php_xcache.dll放在php.ini中指定extension_dir中(本例为"D:\php\ext)。
下面开始配置,打开php.ini。
添加(记得是添加,不要更换原来的zend_extension_ts参数)
zend_extension_ts = "($extension_dir)\php_xcache.dll"
如果没有配置环境变量,需要把($extension_dir)替换成绝对路径。
添加以下项到php.ini末尾,可以直接复制以下配置
[xcache.admin]
xcache.admin.enable_auth = Off
xcache.admin.user = "Cnitpub"
xcache.admin.pass = "Cnitpub"
[xcache]
xcache.shm_scheme = "mmap"
xcache.size = 64M
xcache.count = 4
xcache.slots = 64K
xcache.ttl = 1800
xcache.gc_interval = 1800
xcache.var_size = 8M
xcache.var_count = 4
xcache.var_slots = 64K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.test = Off
xcache.readonly_protection = Off
xcache.mmap_path = "xcache"
xcache.coredump_directory = ""
xcache.cacher = On
xcache.stat = Off
xcache.optimizer = Off
[xcache.coverager]
xcache.coverager = Off
xcache.coveragedump_directory = ""
需要修改的值如下:
xcache.admin.enable_auth XCache后台是否需要验证(这个后台在刚才下载的XCache的admin目录中,可以自由处理,如不需要请设置成Off)
xcache.admin.user XCache后台登陆用户名
xcache.admin.pass XCache后台登陆密码
xcache.size XCache的内存缓存大小,普通网站建议设置为64MB,如果是IDC服务器,可以设置成256MB
xcache.count 设置为CPU的数量(双核算2个,比如我的是两个双核Xeon 3.0,就设置为4)
xcache.var_size
xcache.var_count 跟上两条一样
xcache.mmap_path 共享内存标识名,尽量用xcache,避免跟其它软件冲突
xcache.optimizer 优化器,如果没安装Zend可以开启,如果已经安装好Zend了,设置成Off
如何去掉QQ或新浪账户登录下面的那个 只需一步 快速开始
作者:野风信子 日期:2012-04-26
页头二级导航栏广告,省份城市的添加
作者:野风信子 日期:2012-04-12
二级导航其实是后台设置的,管理中心---运营---站点广告---全局 页头二级导航栏广告---(您根据需要设置)---设置展现方式时选择代码,分享自复转军人网:增加以下代码即可。
<div align="center">
<table border="0" width="958" id="table1" cellspacing="0" cellpadding="0" height="57">
<tr>
<td width="60" height="57" rowspan="2" align="center">
<img border="0" src="static\image\town.gif" width="47" height="41" align="right"></td>
<td width="62" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=51">北京</a></td>
<td width="63" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=791&filter=typeid&typeid=61">上海</a></td>
<td width="63" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=52">天津</a></td>
<td width="63" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=801&filter=typeid&typeid=73">重庆</a></td>
<td width="63" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=783&filter=typeid&typeid=60">黑龙江</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=783&filter=typeid&typeid=59">吉林</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=783&filter=typeid&typeid=58">辽宁</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=53">河北</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=55">河南</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=796&filter=typeid&typeid=66">湖北</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=796&filter=typeid&typeid=67">湖南</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=54">山东</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=56">山西</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=779&filter=typeid&typeid=46">陕西</a></td>
<td width="53" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=791&filter=typeid&typeid=64">安徽</a></td>
<td width="54" height="28" align="center" valign="bottom">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=791&filter=typeid&typeid=63">浙江</a></td>
</tr>
<tr>
<td width="62" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=791&filter=typeid&typeid=62">江苏</a></td>
<td width="63" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=797&filter=typeid&typeid=69">福建</a></td>
<td width="63" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=797&filter=typeid&typeid=68">广东</a></td>
<td width="63" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=797&filter=typeid&typeid=71">海南</a></td>
<td width="63" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=782&filter=typeid&typeid=57">内蒙古</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=801&filter=typeid&typeid=75">云南</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=801&filter=typeid&typeid=74">贵州</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=779&filter=typeid&typeid=49">青海</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=779&filter=typeid&typeid=47">甘肃</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=791&filter=typeid&typeid=65">江西</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=801&filter=typeid&typeid=72">四川</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=779&filter=typeid&typeid=48">宁夏</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=779&filter=typeid&typeid=50">新疆</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=801&filter=typeid&typeid=76">西藏</a></td>
<td width="53" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum.php?mod=forumdisplay&fid=797&filter=typeid&typeid=70">广西</a></td>
<td width="54" height="29" align="center">
<a hideFocus href="http://www.zygw.org/forum-808-1.html">港澳台</a></td>
</tr>
</table>
</div>
效果见置业顾问网。
x2/2.5 x2 修改复制连接为静态
作者:野风信子 日期:2012-03-21
找到
程序代码修改成
程序代码
横排 去掉最后发表,显示版块简介,若有版主,显示版主
作者:野风信子 日期:2011-08-26
查找:
<!--{if empty($forum[redirect])}--><dd><em>{lang forum_threads}: $forum[threads]</em>, <em>{lang forum_posts}: $forum[posts]</em></dd><!--{/if}-->
替换成:
<!--{if $forum[description]}--><p class="xg2">本版简介:$forum[description]</p><!--{/if}-->
DIY 参数详解之[index=x]
作者:野风信子 日期:2011-08-14
在DIY的模块模板中,有一个这样的判断语句:[index=N]...[/index]
下面就针对此判断语句进行一些相关的运用讲解!
------------------------------------------------------------------------------
先看一段diy代码实例:
[index=1]
<a class="style1" href="{url}"{target}>{title}</a>
[/index]
[index=2]
<a class=="style2" href="{url}"{target}>{title}</a>
[/index]
[loop]
<a class="style3" href="{url}"{target}>{title}</a>
[loop]
-------------------------------------------------------------------------------
Discuz-x二次开发:两句非常重要的代码,截取内容长度和过滤UBB代码
作者:野风信子 日期:2011-08-14
$thread['message'] = cutstr($thread['message'], 200, 0, 0, 0, -1);
修改主题列表页的时候就用到了这两句,要求帖子列表页面显示主题的简短内容,把主题内容查询出来就需要进行过滤,过滤以后再对内容长度进行截取,我这里设置的是截取200字节
简单利用QQ获取并显示访客IP地址以及所在地
作者:野风信子 日期:2011-08-14
<script type=text/javascript>
document.write('您的IP:'+IPData[0]+'');
document.write('<br />');
document.write('您来自:'+IPData[2]+' '+IPData[3]+'');

