Ich bin eine neue Biene in Casperjs und Phantomjs Welt. Ich bekomme null vom Skript, wenn ich vom PHP-Skript laufe, während ich Antwort in cmd erhielt.Casperjs Skript gibt Null in PHP
Dies ist PHP-Skript aus, wo ich casperjs Skript namens test.js
<?php
putenv("PHANTOMJS_EXECUTABLE=C:/phantomjs/bin");
putenv("DYLD_LIBRARY_PATH");
$response=null;
$response=exec('C:/casperjs/bin C:/Test.js');
if ($response != null) {
echo("Null Response");
}
else{
echo("Response : " . $response);
} ?>
Dies ist Test.js. genannt Ein casperjs Skript
var casper = require('casper').create({
verbose: false,
logLevel: "debug",
pageSettings: {
loadImages: false,
loadPlugins: false,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'
} });
casper.start('https://www.google.co.in/', function(){
this.echo("From Script",'INFO')
});
casper.run();
Wie Sie sehen, ich Phantom und casperjs in C installiert haben, und ich habe bereits die Umgebungsvariable für beide Für Phantom Env eingestellt. Variable - C: \ phantomjs \ bin \ Für Casper Env. Variable - C: \ casperjs \ bin
Vielen Dank im Voraus.
Sie exec Antwort falsch bekommen, bitte beheben: http://php.net/manual /de/function.exe.php – Vaviloff