既然有寫入權限,爲什麽沒有ftp權限?

解决方案 »

  1.   

    uGain(幽亘)你的回答是什么意思,我怎么看不明白啊!!!!
      

  2.   

    你既然可以向服務器上傳文件,爲什麽不可以把.html修改後再傳上去呢?
      

  3.   

    要是能这样就好了,因为做HTML页面的人是美工,他怎么会懂程序呢,他只管页面的风格,所以说让他来完成替换工作那不是添乱吗?
    所以只有由程序来完成替换工作!!!
      

  4.   

    用DREAMWEAVER,里面有RELATIVE TO (DOCUMENT或者SITE ROOT)。
    或者你用edit菜单里的Find and Replace来进行替换。把"images/"替换成"http://www.timeschina.com/images/ "
      

  5.   

    请问:roots(root)您能示例一下吗/如果可以的话,分就给你了。。哈哈。我很着急。
      

  6.   

    函数:preg_match() 
    --------------------------------------------------------------------------------
     
    Perl 相容语法函数库
    preg_match
    字符串匹配。语法: int preg_match(string pattern, string subject, array [matches]);返回值: 整数/数组函数类型: 数据处理
     
     
    内容说明 
    本函数以 pattern 的规则来匹配字符串 subject。比对结果返回的值放在数组参数 matches 之中,matches[0] 内容就是原字符串 subject、matches[1] 为第一个合乎规则的字符串、matches[2] 就是第二个合乎规则的字符串,余类推。若省略参数 matches,则只是单纯地比对,找到则返回值为 true。 
      

  7.   


    --------------------------------------------------------------------------------
     函数:preg_replace() 
    --------------------------------------------------------------------------------
     
    Perl 相容语法函数库
    preg_replace
    字符串匹配并取代。语法: mixed preg_replace(mixed pattern, mixed replacement, mixed subject);返回值: 混合定义数据函数类型: 数据处理
     
     
    内容说明 
    本函数以 pattern 的规则来匹配字符串 subject,欲取而代之的字符串为参数 replacement。返回值为混合定义数据,为取代后的字符串结果。
     
     
    使用范例 
    下例返回值为 $startDate = 6/19/1969<?php
    $patterns = array("/(19|20\d{2})-(\d{1,2})-(\d{1,2})/", "/^\s*{(\w+)}\s*=/");
    $replace = array("\\3/\\4/\\1", "$\\1 =");
    print preg_replace($patterns, $replace, "{startDate} = 1969-6-19");
    ?>  
      

  8.   

    當然由你來完成,用文本編輯器把所有頁面上的圖片都重新更改一次,再傳到服務器上。把所有的‘images/’替換成‘http://www.timeschina.com/images/’吧。
      

  9.   

    To:
     leojschen(Leo&Lemon) 多谢大虾的关注能结合我的问题,给出一段示例吗?
      

  10.   

    <?
    $filename="index.html";
    $con=file($filename);
    for($i=0;$con[$i];$i++){
      $content.=$con[$i];
    }
    $newcon=explode('images/',$content);
    for($j=0;$newcon[$j];$j++){
      $newcontent.=$newcon[$j].'http://www.timeschina.com/images/';
    }
    $newcontent=substr($newcontent,0,-33);
    $fp = fopen($filename,"w");
    if(fwrite($fp,$newcontent,strlen($newcontent)))
      echo $filename.'替換完成';
    fclose($fp);
    ?>
      

  11.   

    把下面的代碼存成文件,放在需要更改的文件所在的目錄,執行即可。
    不過還是覺得用工具改放心。
    <?
    function filerpc($filename){
    $con=file($filename);
    for($i=0;$con[$i];$i++){
    $content.=$con[$i];
    }
    $newcon=explode('images/',$content);
    for($j=0;$newcon[$j];$j++){
    $newcontent.=$newcon[$j].'http://www.timeschina.com/images/';
    }
    $newcontent=substr($newcontent,0,-33);
    $fp = fopen($filename,"w");
    if(fwrite($fp,$newcontent,strlen($newcontent)))
    echo $filename.'替換完成<br>';
    fclose($fp);
    }
    $handle=opendir('.');
    while ($file=readdir($handle)) {
    if(substr($file,-4,4)==".php")
    filerpc($file);
    }
    closedir($handle); 
    ?>
      

  12.   

    <?
    function filerpc($filename){
    $con=file($filename);
    for($i=0;$con[$i];$i++){
    $content.=$con[$i];
    }
    $newcon=explode('images/',$content);
    for($j=0;$newcon[$j];$j++){
    $newcontent.=$newcon[$j].'http://www.timeschina.com/images/';
    }
    $newcontent=substr($newcontent,0,-33);
    $fp = fopen($filename,"w");
    if(fwrite($fp,$newcontent,strlen($newcontent)))
    echo $filename.'替換完成<br>';
    fclose($fp);
    }
    $handle=opendir('.');
    while ($file=readdir($handle)) {
    if(substr($file,-5,5)==".html")
    filerpc($file);
    }
    closedir($handle); 
    ?>
      

  13.   

    uGain(幽亘)谢谢你的代码,我已经试过了,假设图片都是放在images下面这种方法是可以的,但是,如果有的用户所放置的目录不一样呢,比如:images/1/2/3/
    images/kevin/1/等等,怎么办,最好是能用正则表达式来匹配,但是我不知道应该怎么样做。
      

  14.   

    只要是在images/目錄下就一樣可以啊。那段程序的目的是把頁面中出現的'images/'都替換成''http://www.timeschina.com/images/',一樣可以用的。
      

  15.   

    但是如果图片不放在images下,怎么办呢?
      

  16.   

    $contents = '<img width="12" src="images/a.gif">';
    $url = "http://www.timeschina.com/";
    $pattern = "/<img\s+?(.+)src=(\"|\')??([^\"\'[:space:]]+?)(\"|\')??([^>]*?)>/iU";
    echo htmlspecialchars(preg_replace($pattern, "<img \\1 src=\"".$url."\\3\"\\5>", $contents));
      

  17.   

    phpteam兄:
     樓主說圖片也有可能不放在images下,怎麽做?