Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在CKeditor中显示数组内容?_Php_Ckeditor - Fatal编程技术网

Php 如何在CKeditor中显示数组内容?

Php 如何在CKeditor中显示数组内容?,php,ckeditor,Php,Ckeditor,我需要在CKeditor中显示文档文件的内容。 我读取doc文件的内容并将其逐行传递到数组中: $rs = fopen("text.doc", "r"); while ($line = fgets($rs, 1024)) { $this->data[] = $line . "<BR>"; } CKeditor立即工作并显示在我的网页上。。但是没有任何内容? 我应该在foreach内部做什么来将数

我需要在CKeditor中显示文档文件的内容。 我读取doc文件的内容并将其逐行传递到数组中:

$rs = fopen("text.doc", "r");

            while ($line = fgets($rs, 1024)) {
                $this->data[] = $line . "<BR>";
            }
CKeditor立即工作并显示在我的网页上。。但是没有任何内容? 我应该在foreach内部做什么来将数组内容传递到编辑器中?
请帮助=(

<代码> .doc 文件被压缩,不能按此方式读取,请考虑使用以访问内部内容。

编辑:经过进一步调查,PHPDoc似乎只能写而不能读

PHP工具在这方面非常不足。最好的办法是在命令行上使用类似的工具进行文件转换。然后可以在CKEditor中加载该文档

编辑:在OP的评论之后:


让我们考虑它是一个TXT文件…我需要CKDDSER方法< /P> 将解码的HTML内容加载到Textarea中,并为该Textarea提供一个HTML ID或类:

$textarea\u content=htmlspecialchars\u decode(文件获取内容('text.doc'));

然后,在HTML中,在JavaScript标记内调用CKEditor,用编辑器替换textarea:

<html>
<head>
<!-- include CKEditor in a <script> tag first -->
<script type="text/javascript">
    window.onload = function()
    {
        CKEDITOR.replace( 'editor1' );
    };
</script>
</head>
<body>
<textarea id="editor1" name="editor1"><?php echo $textarea_content ?></textarea>
</body>

window.onload=函数()
{
CKEDITOR.replace('editor1');
};


有更多的细节。问题不是DOC文件。问题是如何传递AARAY,你似乎不理解。PHP不能原样读取.doc文件。它不是一个简单的文本文件。“传递数组”是这里的最小问题。让我们考虑它是一个TXT文件……我需要CKDDSER方法。

<html>
<head>
<!-- include CKEditor in a <script> tag first -->
<script type="text/javascript">
    window.onload = function()
    {
        CKEDITOR.replace( 'editor1' );
    };
</script>
</head>
<body>
<textarea id="editor1" name="editor1"><?php echo $textarea_content ?></textarea>
</body>