网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > DedeCMS
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 180.125.123.205
Old 2012-07-16, 01:55 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default Dede采集分页文章时相对路径问题解决方案

使用DedeCMS在采集文章的时候,发现DEDE采集文章相对路径文章时的一个bug,上网查询了一个晚上终于找到类似问题的解决办法,最后把这个问题的根源找到并且解决了。

问题描述:

  当采集目标文章中列表或者分页信息是绝对路径时,DEDE可以正确采集。
  当采集目标文章中列表或者分页信息是相对路径,但是以 '/'开头(如 /2012/0328/1943.html)DEDE也可以正确采集。
  当采集目标文章中列表或者分页信息是相对路径,但不是以 '/'开头(如 2012/0328/1943.html)DEDE就不能正确采集了。

解决方案:

  问题的根源出在 dedehtml2.class.php 中的 FillUrl 函数上,大概在394行左右:

if( strlen($surl) < 7 )
{
$okurl = $this->BaseUrlPath.'/'.$surl;
}
else if( strtolower(substr($surl,0,7))=='http://' )
{
$okurl = preg_replace('/^http:\/\//i', '', $surl);
}
else
{
//$okurl = $this->BaseUrlPath.'/'.$surl;
$okurl = $this->HomeUrl.'/'.$surl;
}  被注释掉的(红色)代码是原始的,增加下面一行(绿色)代码问题就解决了。
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 02:09 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.