首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用php添加FCKeditor

如何使用php添加FCKeditor
EN

Stack Overflow用户
提问于 2010-09-06 15:26:32
回答 1查看 12.5K关注 0票数 1

我是这个FCKeditor的新手,我正在使用下面提到的代码,我在文本编辑器中格式化文本,并使用echo语句显示相同的文本,但它只显示纯文本(没有格式化)如何显示具有格式化语法的文本。请提前给我指引.thanks

代码语言:javascript
复制
 <?php
    include("fckeditor.php");

    $sBasePath = $_SERVER['PHP_SELF'] ;
            $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
            $oFCKeditor = new FCKeditor('FCKeditor') ;
            $oFCKeditor->BasePath   = $sBasePath ;
            $oFCKeditor->Value      = $ing ;
            $oFCKeditor->Create() ;
            ?>

<html> 
<head>

<title>Editor</title>
</head>
<body>
<form name="frmedit" id = "frmedit" method="post" enctype="multipart/form-data"> 
Title &nbsp;:&nbsp;<input type="text" name="txttitle" id = "txttitle">

<br>
<br>
<input type="submit" name="subsubmit" id="subsubmit" value="SUBMIT">
</form> 
</body>
</html>

<?php
if($_POST["subsubmit"]=="SUBMIT"){
$part2 = $_POST["FCKeditor"];
echo $part2;
}
?>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-09-06 15:37:28

已更新的答案

您需要将FCKEditor代码放在<form> </form>标记内,而不是放在顶部。此外,还需要将$_POST["FCKEditor"]放在$oFCKeditor->Value变量中。

这样做:它在我的机器上运行良好,并在FCKEditor文本区域中显示格式化的超文本标记语言:

代码语言:javascript
复制
<html> 
<head>

<title>Editor</title>
</head>
<body>
<form name="frmedit" id = "frmedit" method="post" enctype="multipart/form-data"> 
Title &nbsp;:&nbsp;<input type="text" name="txttitle" id = "txttitle">
<?php
    include("fckeditor.php");

    $sBasePath = $_SERVER['PHP_SELF'] ;
            $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
            $oFCKeditor = new FCKeditor('FCKeditor') ;
            $oFCKeditor->BasePath   = $sBasePath ;
            $oFCKeditor->Value      = $_POST["FCKeditor"] ;
            $oFCKeditor->Create() ;
            ?>
<br>
<br>
<input type="submit" name="subsubmit" id="subsubmit" value="SUBMIT">
</form> 
</body>
</html>

提示:

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3649720

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档