刷新
新版泡客最新的两处调整和改进
发布日期:2010-1-13 0:42:15

在说这两个改进之前,先引一段话:

用户浏览网站还是两个主要原则,第一:内容是否有帮助;第二:网页打开速度是否理想;

第一个原则这里就不展开说了,老七做站的目的很简单,Title上就写的很清楚了,只是身边发生的一些事情,一些问题的解决方法,参合自己的一些小小看法而已。

第二个原则在新版网站上很多朋友也已经看到了:简洁!

网页简洁到几乎没有什么图片(文章中包含的图片例外,一样清晰度是80%,保证正常网页浏览清晰度)

现在的服务器用的是上海沈家弄电信机房(世博会专用机房),速度应该还可以啦;

接下来就是网页代码的优化,数据库调用方式的优化,除非是生成静态,否则还是会调用数据库,针对这个问题的产生,便有了此文 <下面是正文>

第一个改进:

通过使用ASP的FSO功能,减少数据库的读取,可减少90%的服务器负荷。页面访问速度基本与静态页面相当;

解释一下:比如说访问 index.asp 这个页面,则在设定的 /html/ 目录中生成 index.asp.txt 这样一个文件(内容是 index.asp 文件生成静态后的代码),并设定文件保存时间(以分钟计算),第二个访问 index.asp 的访客直接调用 index.asp.txt 的代码;也就等于第一个访问此页面的访客代替管理员执行生成静态这个操作;

第二个调整:

上传文件保存目录按 /年/月/日/ 存放,方便文件管理;代码如下(ASP):

ASP/Visual Basic Code复制内容到剪贴板
  1. Function CreateMultiFolder(ByVal CFolder)   
  2. Dim objFSO,PhCreateFolder,CreateFolderArray,CreateFolder   
  3. Dim i,ii,CreateFolderSub,PhCreateFolderSub,BlInfo   
  4. BlInfo = False  
  5. CreateFolder = CFolder   
  6. On Error Resume Next  
  7. Set objFSO = Server.CreateObject("scripting.FileSystemObject")   
  8. If Err Then  
  9. Err.Clear()   
  10. Exit Function  
  11. End If  
  12. CreateFolder = Replace(CreateFolder,"","/")   
  13. If Left(CreateFolder,1)="/" Then  
  14. CreateFolder = Right(CreateFolder,Len(CreateFolder)-1)   
  15. End If  
  16. If Right(CreateFolder,1)="/" Then  
  17. CreateFolder = Left(CreateFolder,Len(CreateFolder)-1)   
  18. End If  
  19. CreateFolderArray = Split(CreateFolder,"/")   
  20. For i = 0 to UBound(CreateFolderArray)   
  21. CreateFolderSub = ""  
  22. For ii = 0 to i   
  23. CreateFolderSub = CreateFolderSub & CreateFolderArray(ii) & "/"  
  24. Next  
  25. PhCreateFolderSub = Server.MapPath(CreateFolderSub)   
  26. If Not objFSO.FolderExists(PhCreateFolderSub) Then  
  27. objFSO.CreateFolder(PhCreateFolderSub)   
  28. End If  
  29. Next  
  30. If Err Then  
  31. Err.Clear()   
  32. Else  
  33. BlInfo = True  
  34. End If  
  35. End Function  
  36. Response.Write CreateMultiFolder("/"&year(now)"/"&month(now)"/"&day(now)"/")  

特注:第一个改进针对asp网站没有生成静态功能,需要的话下面评论中写上你的邮件地址;