2012-01-26 03:49
浏览 19


the page that i want to get from my php-script contains ajax. So when i do something like: file_get_contents($url);

i receive just the contents with javascript.

is it possible to get the page with all ajax executed?

图片转代码服务由CSDN问答提供 功能建议

我想从php-script获取的页面包含ajax。 因此,当我执行以下操作时: file_get_contents($ url);


是否可以获取 所有ajax执行的页面?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongye1942 2012-01-26 03:56

    To run javascript contents from javascript coming in through AJAX, you would have to run eval on the script, but you better make absolutely sure the javascript isn't "user-input", otherwise using that, you could have some serious security issues on your hands.

    It's also not good practice to use eval - better to load a js file when you pull the contents through AJAX and have your AJAX success activate a function in the js file.

    点赞 评论

相关推荐 更多相似问题