简体   繁体   中英

Can i use SIMPLE HTML DOM PARSER to parse php?

现在,我有了这个index.html文件,然后将其全部内容传输到index.php ,我正在使用此解析器http://simplehtmldom.sourceforge.net/来解析index.html,我可以使用吗它也解析index.php?

只要那里没有PHP代码(即文件已经由服务器处理)

If it's just a PHP file with a .php ending, you can parse it no problem. The file extension doesn't matter.

If the file actually contains PHP snippets, you will encounter problems, as PHP code has no place in a HTML structure. In that case, you would have to additionally use a tool like the PHP tokenizer to extract the source code first. But that would really depend on what you want to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM