本文整理匯總了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());
}