fckeditor类中的BasePath属性,只接受绝对路径这一点没错。。可为什么不支持带有盘符的绝对路径呢??比如我用dirname(__FILE__)获取到当前目录,赋值给$x然后我用$x."/"来给BasePath属性覆盖其值这样一来的话,我再调用creatHtml方法的时候,页面空白了。。这个属性难道只能使用不带盘符的绝对路径么?

解决方案 »

  1.   

    fckeditor里面涉及到很多js和其他一些东西,只能以网络调用的方式来调用。
    而你加了盘符后,就是本地文件式调用了,当然会出错。即,你应该:
    http://localhost/fckeditor/****

    /fckeditor/****
    的方式调用。而不能:
    D:/web/fckeditor/****的方式调用
      

  2.   


    define(CLS_DIR,dirname(__FILE__)."/class/");
    include_once(CLS_DIR."/FCKeditor.class.php");
    $ed = new FCKeditor("txtcon") ;
    //$ed->BasePath   = CLS_DIR;
    $ed->BasePath   = "/include/class/";
    $ed->ToolbarSet = "Default";
    $ed->Width      = "100%";
    $ed->Height     = "320";
    $ed->Config['AutoDetectLanguage'] = true ;
    $ed->Config['DefaultLanguage']  = 'zh' ;如果把$ed->BasePath   = "/include/class/";换成$ed->BasePath = CLS_DIR;就无效了,输出的时候就是空白页。调用部分:
    $ed->Height     = "150";  //覆盖高度
    $ed->ToolbarSet = "Basic"; //覆盖工具栏
    $FCKeditor = $ed->CreateHtml();
    echo $FCKeditor;
      

  3.   

    你看看输出的源码吧<iframe………………src=""src地址,追踪一下,跟BasePath有关,你改成带盘符的路径,显然会出问题如果必要,你可以在src这个地方改一下
      

  4.   

    用$_SERVER['PHP_SELF'];就是网络路径了。
      

  5.   

    define(CLS_DIR,$_SERVER['PHP_SELF']."/class/");