本文整理汇总了PHP中Console::writeln方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::writeln方法的具体用法?PHP Console::writeln怎么用?PHP Console::writeln使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::writeln方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Product_Unit
break;
case 'units':
$Unit = new Product_Unit();
foreach ($Unit->findList(array('Name <> -')) as $Unit) {
$Unit->Name = rtrim($Unit->Name, 'м') . 'мм';
$Unit->save();
}
break;
case 'names':
$Product = new Product();
$Layout = new Product_Layout_Standard();
$params = array();
$params[] = 'CategoryId = ' . $Layout->getCategory()->Id;
foreach ($Product->findList($params) as $Product) {
if (strpos($Product->Name, 'поликарбонат') > 0) {
continue;
}
$Product->Name .= ' поликарбонат "' . $Product->getBrand()->Name . '"';
$Product->save();
}
break;
case 'mail':
Console::writeln(sprintf('%dMb', memory_get_peak_usage(true) / 1024 / 1024));
if (mail($argv[2], 'Hello from ankor.com.ua', 'Here is the test email')) {
Console::writeln('Email sent');
} else {
Console::writeln('Failed');
}
break;
}
echo "\n";
示例2: count
if ($i == 'a') {
break;
}
Console::left(count(${$i}), 4);
Console::left(File::getFilesize($stats['size'][$i], 'b,K,M,G'), 5);
Console::left($stats['lines'][$i] . 'L', 8);
Console::write('| ');
}
Console::left(count($m) + count($c) + count($v), 4);
Console::left(File::getFilesize($stats['size']['a'], 'b,K,M,G'), 5);
Console::left($stats['lines']['a'] . 'L', 8);
Console::writeln('|');
Console::write('\\');
Console::write(str_repeat('=', 98));
Console::writeln('/');
Console::writeln();
if ($argv[1]) {
$sign = '$';
$time = $price = 0;
$arr = explode('/', $argv[1]);
if (count($arr) == 2) {
$price = $stats['lines']['a'] / $arr[1];
$sign = $arr[0] ? $arr[0] : $sign;
} else {
$price = $stats['lines']['a'] * $arr[1];
}
$time = round($stats['lines']['a'] / 1500);
Console::writeln('Price: ' . Price::show($price) . $sign . ', Time: ' . $time . ' days.');
Console::writeln();
}
//Console::writeln('DONE');
示例3:
$DB->execute($q);
if (in_array($DB->getError(), $codes)) {
Console::write($key . ' ');
} else {
Console::write($key . ' ');
$error[] = $q;
}
}
Console::writeln();
} else {
}
} else {
Console::left($new['name'], 30);
// new table
$DB->execute($query);
if (in_array($DB->getError(), $codes)) {
Console::writeln('added');
} else {
Console::writeln('FAILED!');
//$error[] = $query;
$error[] = $DB->getError(true);
}
}
}
continue;
}
}
}
Console::writeln($error);
Console::writeln('DONE');
示例4: elseif
$fd_name = array_search($fd, $fds);
if ($fd_name == 'stdin') {
/* let readline handle use input */
readline_callback_read_char();
} elseif ($fd_name == 'sck') {
if (feof($fd)) {
$ret = FALSE;
} else {
$ret = $console->debugger->getData();
}
if ($ret === FALSE) {
/* EOF - close this fd */
@fclose($fd);
$sck = NULL;
$console->debugger = NULL;
$console->writeln("Debugger Disconnected");
}
} elseif ($fd_name == 'listen') {
/* accept the incomming connection */
$sck = stream_socket_accept($listen);
/* don't let any more in */
fclose($listen);
$listen = NULL;
$p = setting('accept');
if (!empty($p)) {
$ip = strtok(stream_socket_get_name($sck, TRUE), ':');
if (!wildMatch($p, $ip)) {
/* try to match against the hostname */
$h = gethostbyaddr($ip);
if (!wildMatch($p, $h)) {
$console->writeln("Rejected connection from {$h} [{$ip}]");