duanniu4106 2012-08-27 23:26
浏览 116

有没有办法,不使用eval(),读取预先解析为生成的HTML的本地PHP文件?

This seems like it should be an obvious, quick solution, but that's not turning out to be the case.

I have a local file that does some database work and outputs HTML, let's call this file1. I have another file that needs to use some of this information, but shouldn't need to generate it itself, file2.

My plan was to just pull the pre-parsed PHP (at this point HTML) into file2, but it's pulling PHP code instead. This could obviously be handled with eval(), but I'd rather not. Something along the lines of wget() might do the trick, but I'd rather not run command line from my PHP script either if possible.

Is there a solution while avoiding the two options above or do I have to just bite the bullet and use one of them?

Quick Clarification: The entirety of file1 is not used. file2 chops out the parts it needs so simply outputting all resulting HTML from file1 is not viable.

  • 写回答

2条回答 默认 最新

  • dsfsda121545 2012-08-27 23:29
    关注

    file_get_contents("http://Full.URL"); And to make it pass 30 characters..

    -- Edit --

    Ok.

    when you try file_get_contents on a URL, php will request the URL, just like a good-o-wget does. You can also use this to trigger scripts.

    check http://www.php.net/manual/en/function.file-get-contents.php for more info.

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型