本文整理汇总了PHP中Symfony\Component\Process\PhpProcess::getCommandLine方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpProcess::getCommandLine方法的具体用法?PHP PhpProcess::getCommandLine怎么用?PHP PhpProcess::getCommandLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\PhpProcess
的用法示例。
在下文中一共展示了PhpProcess::getCommandLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCommandLine
public function testCommandLine()
{
$process = new PhpProcess(<<<'PHP'
<?php echo 'foobar';
PHP
);
$commandLine = $process->getCommandLine();
$f = new PhpExecutableFinder();
$this->assertContains($f->find(), $commandLine, '::getCommandLine() returns the command line of PHP before start');
$process->start();
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
$process->wait();
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
}
示例2: testCommandLine
public function testCommandLine()
{
if ('phpdbg' === PHP_SAPI) {
$this->markTestSkipped('phpdbg SAPI is not supported by this test.');
}
$process = new PhpProcess(<<<PHP
<?php echo 'foobar';
PHP
);
$f = new PhpExecutableFinder();
$commandLine = $f->find();
$this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP before start');
$process->start();
$this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start');
$process->wait();
$this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
}
示例3: createAndRun
/**
* Initiates new actor in a new PHP process
* @param integer $id An unique id of an actor, should be free tcp-port in current implementation
* @param callable $handler
* @return PhpProcess
*/
public static function createAndRun($id, callable $handler)
{
$serializedHandler = base64_encode((new Serializer())->serialize($handler));
$autoloadPath = Utils::getAutoloadPath();
$process = new PhpProcess(<<<EOF
<?php
require '{$autoloadPath}';
\\Phactor\\Phactor\\Actor::initializeChild({$id}, '{$serializedHandler}');
?>
EOF
);
if (null === $process->getCommandLine()) {
$process->setPhpBinary(PHP_BINARY);
}
// workaround for portable windows php
$process->start();
return $process;
}
示例4: getCommandLine
/**
* @return CommandLine
*/
public function getCommandLine()
{
return new CommandLine(parent::getCommandLine());
}