当前位置: 首页>>代码示例>>PHP>>正文


PHP writeln函数代码示例

本文整理汇总了PHP中writeln函数的典型用法代码示例。如果您正苦于以下问题:PHP writeln函数的具体用法?PHP writeln怎么用?PHP writeln使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了writeln函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: convert

function convert($number)
{
    // Если длина номера больше 6, значит, это нормальный номер, а не какой то служебный,
    // Будем пробовать его тарифицировать.
    if (strlen($number) > 6) {
        // Городские номера
        if (strlen($number) == 7) {
            // Код нашего города 391. Замените этот код на Ваш при необходимости
            $number = '7391' . $number;
        }
        // Неверно набранные номера тоже удаляем
        if (strlen($number) == 8 || strlen($number) == 9) {
            writeln("wrong CDR number: " . $number);
            return false;
        }
        // Номера на мобильные и МГ, которые были набраны без 8ки
        if (strlen($number) == 10) {
            // Добавляем 7 вначале
            $number = '7' . $number;
        }
        // Международная связь
        if (preg_match('/^810/', $number)) {
            $number = preg_replace("/^810/", "", $number);
        }
        // Межгород
        if (substr($number, 0, 1) == 8) {
            $number = '7' . substr($number, 1);
        }
        return $number;
    } else {
        // иначе возвращаем false.
        // В этом случае, данная CDR запись не будет передана на обработку остальным плагинам-обработчикам
        return false;
    }
}
开发者ID:nolka,项目名称:logconverter,代码行数:35,代码来源:2toE164.php

示例2: kill

 public function kill()
 {
     if ($this->exists()) {
         writeln("<comment>Kill elasticsearch container {$this->container}</comment>");
         $command = Env::evalDocker() . "docker rm -f {$this->container}";
         runLocally($command);
     }
 }
开发者ID:ekandreas,项目名称:docker-bedrock,代码行数:8,代码来源:Elasticsearch.php

示例3: stop

 public function stop()
 {
     try {
         writeln("Stop docker-machine {$this->name}");
         $output = runLocally("docker-machine stop {$this->name}");
         writeln("<comment>Docker-machine {$this->name} stopped</comment>");
     } catch (Exception $ex) {
     }
 }
开发者ID:ekandreas,项目名称:docker-laravel,代码行数:9,代码来源:Machine.php

示例4: count_down

/**
 * Creates count down with 1 sec steps
 * 
 * @param String $text the text of the countdown
 * @param int $secs number of seconds for the countdown
 **/
function count_down($text, $secs)
{
    writeln($text);
    writeln("Press CTRL+C to interrupt the countdown.");
    for (; $secs > 0; $secs--) {
        echo $secs . ".. ";
        sleep(1);
    }
    writeln();
    // new line after the countdown
}
开发者ID:laiello,项目名称:pef,代码行数:17,代码来源:cli.lib.php

示例5: testConcreteFactory

function testConcreteFactory($bookFactoryInstance)
{
    // вызываем  метод создания PHP книги - наш код не зависит от того какое именно издательство
    // передано (фабрика какого именно издательства передана) для реализации создания книг
    $phpBookOne = $bookFactoryInstance->makePHPBook();
    writeln('Автор первой книги  по PHP: ' . $phpBookOne->getAuthor());
    writeln('Заголовок первой книги  по PHP: ' . $phpBookOne->getTitle());
    $phpBookTwo = $bookFactoryInstance->makePHPBook();
    writeln('Автор второй книги по PHP: ' . $phpBookTwo->getAuthor());
    writeln('Заголовок второй книги по PHP:: ' . $phpBookTwo->getTitle());
    $mySqlBook = $bookFactoryInstance->makeMySQLBook();
    writeln('Автор  книги по MySQL: ' . $mySqlBook->getAuthor());
    writeln(' Заголовок книги по MySQL: ' . $mySqlBook->getTitle());
}
开发者ID:valerij-usachov,项目名称:SandBox,代码行数:14,代码来源:index.php

示例6: kill

 public function kill()
 {
     if ($this->exists()) {
         writeln('<comment>Kill web container</comment>');
         $command = "docker rm -f {$this->container}";
         Helpers::doLocal($command);
     }
     $command = "cd {$this->dir} && docker images";
     $output = Helpers::doLocal($command);
     if (preg_match('/' . $this->image . '\\s.*latest\\s*([[:alnum:]]+).*/i', $output, $matches)) {
         $command = "cd {$this->dir} && docker rmi {$this->image}";
         Helpers::doLocal($command);
     }
 }
开发者ID:ekandreas,项目名称:docker-laravel,代码行数:14,代码来源:Web.php

示例7: search_result

function search_result($title, $link, $zid, $time, $body)
{
    global $server_name;
    global $protocol;
    $date = date("Y-m-d H:i", $time);
    if ($zid == "") {
        $by = "Anonymous Coward";
    } else {
        $by = "<a href=\"" . user_page_link($zid) . "\">{$zid}</a>";
    }
    writeln("<article>");
    writeln("\t<h1><a href=\"{$link}\">{$title}</a></h1>");
    writeln("\t<h2>{$protocol}://{$server_name}{$link}</h2>");
    writeln("\t<h3>by {$by} on {$date}</h3>");
    writeln("\t<p>{$body}</p>");
    writeln("</article>");
}
开发者ID:scarnago,项目名称:pipecode,代码行数:17,代码来源:search.php

示例8: ensure

 public static function ensure($actionType)
 {
     $envToCheck = [];
     if ($actionType == 'docker') {
         $envToCheck = ['container'];
     }
     foreach ($envToCheck as $key => $name) {
         try {
             $value = env($name);
         } catch (\Exception $ex) {
             $value = null;
         }
         if (!$value) {
             $stage = null;
             if (input()->hasArgument('stage')) {
                 $stage = input()->getArgument('stage');
             }
             writeln("<fg=red>Environment variable '{$name}' is missing in '{$stage}', please define before running this command!</fg=red>");
             die;
         }
     }
 }
开发者ID:ekandreas,项目名称:docker-laravel,代码行数:22,代码来源:Env.php

示例9: getTitle

        return $this->author;
    }
    function getTitle()
    {
        return $this->title;
    }
}
class BookAdapter
{
    private $book;
    function __construct(SimpleBook $book_in)
    {
        $this->book = $book_in;
    }
    function getAuthorAndTitle()
    {
        return $this->book->getTitle() . ' by ' . $this->book->getAuthor();
    }
}
// client
writeln('BEGIN TESTING ADAPTER PATTERN');
writeln('');
$book = new SimpleBook("Gamma, Helm, Johnson, and Vlissides", "Design Patterns");
$bookAdapter = new BookAdapter($book);
writeln('Author and Title: ' . $bookAdapter->getAuthorAndTitle());
writeln('');
writeln('END TESTING ADAPTER PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
开发者ID:ehsangazar,项目名称:design-patterns-php,代码行数:31,代码来源:adapter.php

示例10: update

 public function update(AbstractSubject $subject)
 {
     writeln('*IN PATTERN OBSERVER - NEW PATTERN GOSSIP ALERT*');
     writeln(' new favorite patterns: ' . $subject->getFavorites());
     writeln('*IN PATTERN OBSERVER - PATTERN GOSSIP ALERT OVER*');
 }
开发者ID:manachyn,项目名称:trainings,代码行数:6,代码来源:Observer.php

示例11: ini_set

<?php

ini_set('display_errors', '1');
function __autoload($class_name)
{
    set_include_path('class');
    include_once $class_name . '.php';
}
// client
writeln('BEGIN TESTING FACADE PATTERN');
writeln('');
$book = new Book('Design Patterns', 'Gamma, Helm, Johnson, and Vlissides');
writeln('Original book title: ' . $book->getTitle());
writeln('');
$bookTitleReversed = CaseReverseFacade::reverseStringCase($book->getTitle());
writeln('Reversed book title: ' . $bookTitleReversed);
writeln('');
writeln('END TESTING FACADE PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
开发者ID:valerij-usachov,项目名称:SandBox,代码行数:22,代码来源:index.php

示例12: server

require 'recipe/drupal8.php';
server('prod', '146.185.128.63', 9999)->user('deploy')->identityFile()->stage('production')->env('deploy_path', '/usr/share/nginx/html/kristiankaadk');
set('repository', 'git@github.com:kaa4ever/kristiankaadk.git');
task('deploy:permissions', function () {
    run('if [ -d {{deploy_path}}/shared ]; then sudo chown -R deploy:deploy {{deploy_path}}/shared; fi');
    run('if [ -d {{deploy_path}}/releases ]; then sudo chown -R deploy:deploy {{deploy_path}}/releases; fi');
});
task('docker:reboot', function () {
    cd('{{release_path}}');
    run('docker stop kristiankaa.site || true');
    run('docker rm kristiankaa.site || true');
    run('docker-compose -f docker-compose.prod.yml up -d');
});
task('drush:make', function () {
    writeln("<info>Drush: Building site</info>");
    run('docker exec kristiankaa.site bash -c "cd /var/www/html && drush make site.make -y"');
});
task('drush:updb', function () {
    writeln("<info>Drush: Updating database</info>");
    run('docker exec kristiankaa.site drush updb -y --root=/var/www/html');
});
task('drush:cache', function () {
    writeln("<info>Drush: Rebuilding cache</info>");
    run('docker exec kristiankaa.site drush cr --root=/var/www/html');
});
after('deploy:prepare', 'deploy:permissions');
after('deploy:update_code', 'docker:reboot');
after('deploy:update_code', 'drush:make');
after('deploy', 'drush:updb');
after('deploy', 'drush:cache');
开发者ID:kaa4ever,项目名称:kristiankaadk,代码行数:30,代码来源:deploy.php

示例13: FlyweightFactory

$flyweightFactory = new FlyweightFactory();
$flyweightBookShelf1 = new FlyweightBookShelf();
$flyweightBook1 = $flyweightFactory->getBook(1);
$flyweightBookShelf1->addBook($flyweightBook1);
$flyweightBook2 = $flyweightFactory->getBook(1);
$flyweightBookShelf1->addBook($flyweightBook2);
writeln('test 1 - show the two books are the same book');
if ($flyweightBook1 === $flyweightBook2) {
    writeln('1 and 2 are the same');
} else {
    writeln('1 and 2 are not the same');
}
writeln('');
writeln('test 2 - with one book on one self twice');
writeln($flyweightBookShelf1->showBooks());
writeln('');
$flyweightBookShelf2 = new FlyweightBookShelf();
$flyweightBook1 = $flyweightFactory->getBook(2);
$flyweightBookShelf2->addBook($flyweightBook1);
$flyweightBookShelf1->addBook($flyweightBook1);
writeln('test 3 - book shelf one');
writeln($flyweightBookShelf1->showBooks());
writeln('');
writeln('test 3 - book shelf two');
writeln($flyweightBookShelf2->showBooks());
writeln('');
writeln('END TESTING FLYWEIGHT PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
开发者ID:manachyn,项目名称:trainings,代码行数:31,代码来源:Flyweight.php

示例14: writeln

writeln('<td class="left_col">');
print_left_bar("account", "feed");
writeln('</td>');
writeln('<td class="fill">');
writeln('<table class="fill">');
writeln('	<tr>');
for ($c = 0; $c < 3; $c++) {
    writeln('		<td class="feed_box">');
    writeln('			<table class="zebra">');
    $r = 0;
    $row = run_sql("select feed_user.fid, title from feed_user inner join feed on feed_user.fid = feed.fid where zid = ? and col = ? order by pos", array($auth_zid, $c));
    if (count($row) == 0) {
        writeln('				<tr><td>(no feeds)</td></tr>');
    }
    for ($i = 0; $i < count($row); $i++) {
        writeln('				<tr>');
        writeln('					<td>' . $row[$i]["title"] . '</td>');
        writeln('					<td class="right"><a href="remove?fid=' . $row[$i]["fid"] . '"><span class="icon_16" style="background-image: url(/images/remove-16.png)">Remove</span></a></td>');
        writeln('				</tr>');
        $r = $r ? 0 : 1;
    }
    writeln('			</table>');
    writeln('			<div class="right"><a href="add?col=' . $c . '"><span class="icon_16" style="background-image: url(/images/add-16.png)">Add</span></a></div>');
    writeln('		</td>');
}
writeln('	</tr>');
writeln('</table>');
writeln('</td>');
writeln('</tr>');
writeln('</table>');
print_footer();
开发者ID:scarnago,项目名称:pipecode,代码行数:31,代码来源:edit.php

示例15: writeln

$book1 = clone $sqlProto;
$book1->setTitle('SQL For Cats');
writeln('Book 1 topic: ' . $book1->getTopic());
writeln('Book 1 title: ' . $book1->getTitle());
writeln('');
$book2 = clone $phpProto;
$book2->setTitle('OReilly Learning PHP 5');
writeln('Book 2 topic: ' . $book2->getTopic());
writeln('Book 2 title: ' . $book2->getTitle());
writeln('');
$book3 = clone $sqlProto;
$book3->setTitle('OReilly Learning SQL');
writeln('Book 3 topic: ' . $book3->getTopic());
writeln('Book 3 title: ' . $book3->getTitle());
writeln('');
writeln('END TESTING PROTOTYPE PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
class SubObject
{
    static $instances = 0;
    public $instance;
    public function __construct()
    {
        $this->instance = ++self::$instances;
    }
    public function __clone()
    {
        $this->instance = ++self::$instances;
开发者ID:fxlacroix,项目名称:component,代码行数:31,代码来源:Prototype.php


注:本文中的writeln函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。