我正在开发一个PHP系统,需要复制Word文本并将它们粘贴到系统中。 稍后,系统将替换段落并放置换行符以格式化输出。 但是,如果用户错过要复制的段落,则系统显示格式将被破坏并混乱。 如何强制他们从Word复制段落或如何在PHP中插入换行符?
I am developing a system in PHP that is required to copy Word text and pasting them into the system. Later on, the system replaces the paragraph and put the line breaks to format the output. However if the user misses the paragraph to copy then the system display formatting is broken and messed. How to force them to copy the paragraph from Word or how can I insert the line break in PHP?
最满意答案
我稍后自己修复了这个问题,插入简单的if else条件来计算数量 标签,并把额外的 如果计数小于所需的换行符,如下所示:
$br_count=substr_count($string, '<br>'); if($br_count<=5) { fwrite($fh,"<br>"); //Adds the extra line break here }$ string变量保存要处理的段落。
I fixed this issue myself later on inserting simple if else condition to count the number of tags and put the extra if the count is less than required line breaks as follows:
$br_count=substr_count($string, '<br>'); if($br_count<=5) { fwrite($fh,"<br>"); //Adds the extra line break here }$string variable holds the paragraph to process.
更多推荐
发布评论