本文整理匯總了PHP中CLI::write方法的典型用法代碼示例。如果您正苦於以下問題:PHP CLI::write方法的具體用法?PHP CLI::write怎麽用?PHP CLI::write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CLI
的用法示例。
在下文中一共展示了CLI::write方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: after
/**
* Automatically executed after the task action.
*
* @return void
*/
protected function after()
{
if ($this->auto_render === TRUE and $this->template instanceof View) {
// Render and display template
CLI::write($this->template->render());
}
parent::after();
}
示例2: function
<?php
/**
* Server utilities
*/
CLI::on('server :action', function ($action) {
switch ($action) {
case 'run':
$host = CLI::input("host", '0.0.0.0');
$port = CLI::input("port", 8888);
CLI::write("[<white>APP</white>] <purple>Starting</purple> webserver on <cyan>{$host}</cyan>:<green>{$port}</green>");
CLI::writeln("");
exec("(which open && open http://{$host}:{$port}/); php -S {$host}:{$port} -t " . dirname(__DIR__) . "/public");
break;
default:
echo "Server utilities.", PHP_EOL;
echo "- Available actions: run", PHP_EOL;
break;
}
});
示例3: action
/**
* Create task content and save in file.
*
* @return void
*/
protected function action()
{
CLI_Task_Scaffold::create($this->options['name'], $this->options['template']);
CLI::write(__('Task `:name` created!', array(':name' => $this->options['name'])));
}