开发者

PHP parse without replacing

开发者 https://www.devze.com 2022-12-27 21:07 出处:网络
I have seen some parsing code that\'s really long, but it doesn\'t involve replacing stuff inside an opened file using file_get_contents() for example. I\'m talking about say parsing a .doc into .html

I have seen some parsing code that's really long, but it doesn't involve replacing stuff inside an opened file using file_get_contents() for example. I'm talking about say parsing a .doc into .html format. They read the file and then output it in html. I have tried this using arrays and preg_replace, but it just doesn't seem as clean as other code. Anyone know the basic concept of parsing? Thanks, tell me if im not clear.

Edit: Lets say I have this from a doc or rtf file: \b text \b

That would need to be converted to <strong>text</strong>. Others do it without preg_replace or str_replace and stuff, almost as 开发者_如何学JAVAif they build the new page somehow.


Are you trying to "converting" a .doc into a .html file? That's not considered parsing. For something like that, try looking at antiword.

0

精彩评论

暂无评论...
验证码 换一张
取 消