CasperJS将数据传递回PHP [英] CasperJS passing data back to PHP

查看:53
本文介绍了CasperJS将数据传递回PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CasperJS.在CasperJS完成其工作(例如检索网页的某些部分)之后,如何将检索到的数据返回给PHP?

CasperJS is being called by PHP using an exec() command. After CasperJS does its work such as retrieving parts of a webpage, how can the retrieved data be returned back to PHP?

推荐答案

您可以将输出从stdout重定向到数组.

You can redirect output from stdout to an array.

页面上,您可以执行以下操作:

On this page it says you can do:

string exec ( string $command [, array &$output [, int &$return_var ]] )

接着说:

如果存在output参数,则指定的数组将被命令的每一行输出填充.

If the output argument is present, then the specified array will be filled with every line of output from the command.

所以基本上可以执行exec('casperjs命令在这里$ array_here);

So basically you can do exec('casperjs command here, $array_here);

这篇关于CasperJS将数据传递回PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆