本文整理汇总了PHP中println函数的典型用法代码示例。如果您正苦于以下问题:PHP println函数的具体用法?PHP println怎么用?PHP println使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了println函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processZipFile
/**
* Download the ZIP file to the Resources directory.
*/
static function processZipFile($sURL)
{
# Prepare the variables
$sZipResource = ROOT . "/Resources/AutoUpdater.zip";
$sZipFolder = ROOT . "/Resources/AutoUpdaterFolder";
$sSystemFolder = ROOT . "/System/";
# Download the file
$sZip = file_get_contents($sURL);
file_put_contents($sZipResource, $sZip);
$pZip = new ZipArchive();
$pZip->open($sZipResource);
$pZip->extractTo($sZipFolder);
unlink($sZipResource);
# What is the folder name?
$aZipFolder = glob(ROOT . "/Resources/AutoUpdaterFolder/*");
# Move all the system files
self::rmdir($sSystemFolder);
rename("{$aZipFolder[0]}/System/", $sSystemFolder);
println(" * {$aZipFolder[0]}/System/ -> {$sSystemFolder}");
# Move the Start.php
unlink(ROOT . '/Start.php');
rename("{$aZipFolder[0]}/Start.php", ROOT . '/Start.php');
println(" * {$aZipFolder[0]}/Start.php -> " . ROOT . '/Start.php');
# And now, clean up our mess.
self::rmdir($sZipResource);
unlink($aZipFolder[0]);
println(" > Successfully updated the System files.");
}
示例2: main
public static function main(array $args = array())
{
$remoteControl = new RemoteControlWithUndo();
$livingRoomLight = new Light("Living Room");
$livingRoomLightOn = new LightOnCommand($livingRoomLight);
$livingRoomLightOff = new LightOffCommand($livingRoomLight);
$remoteControl->setCommand(0, $livingRoomLightOn, $livingRoomLightOff);
$remoteControl->onButtonWasPushed(0);
$remoteControl->offButtonWasPushed(0);
println($remoteControl);
$remoteControl->undoButtonWasPushed();
$remoteControl->offButtonWasPushed(0);
$remoteControl->onButtonWasPushed(0);
println($remoteControl);
$remoteControl->undoButtonWasPushed();
$ceilingFan = new CeilingFan("Living Room");
$ceilingFanMedium = new CeilingFanMediumCommand($ceilingFan);
$ceilingFanHigh = new CeilingFanHighCommand($ceilingFan);
$ceilingFanOff = new CeilingFanOffCommand($ceilingFan);
$remoteControl->setCommand(0, $ceilingFanMedium, $ceilingFanOff);
$remoteControl->setCommand(1, $ceilingFanHigh, $ceilingFanOff);
$remoteControl->onButtonWasPushed(0);
$remoteControl->offButtonWasPushed(0);
println($remoteControl);
$remoteControl->undoButtonWasPushed();
$remoteControl->onButtonWasPushed(1);
println($remoteControl);
$remoteControl->undoButtonWasPushed();
}
示例3: ParseLocation
/**
* Loads a configuration file from a specific location.
*/
static function ParseLocation($sLocation)
{
$sConfigName = substr(basename($sLocation), 0, -4);
if ($sConfigName[0] == "~") {
return false;
}
$aConfiguration = parse_ini_file($sLocation, true);
if (!is_array($aConfiguration) || count($aConfiguration) <= 1) {
println(" * Sorry, looks like the network {$sConfigName} failed to load!");
return false;
}
$pConfig = new stdClass();
$bSlave = false;
foreach ($aConfiguration as $sConfigKey => $aConfigObject) {
if ($sConfigKey[0] == "~") {
$sConfigKey = substr($sConfigKey, 1);
$pConfig->{$sConfigKey} = (object) $aConfigObject;
continue;
}
$aConfigObject = array_merge(array("nickname" => $sConfigKey), $aConfigObject, array("slave" => $bSlave));
$pConfig->Bots[$sConfigKey] = (object) $aConfigObject;
$bSlave = true;
}
$sInstance = $sConfigName . ' (#' . uniqid() . ')';
self::verifyConfiguration($pConfig, $sInstance);
Core::addInstance($sInstance, new CoreMaster($pConfig));
}
示例4: assertAccountCreated
protected function assertAccountCreated()
{
$lead = Accounts::model()->findByAttributes(array('name' => 'testAccount'));
$this->assertTrue($lead !== null);
X2_TEST_DEBUG_LEVEL > 1 && println('account created');
return $lead;
}
示例5: releaseBall
public function releaseBall()
{
println("A gumball comes rolling out the slot...");
if ($this->count != 0) {
$this->count = $this->count - 1;
}
}
示例6: generateDocs
function generateDocs($folder = 'creamture')
{
if (!file_exists('docs/' . $folder)) {
println('Docs folder doesn\'t exists');
return;
}
$daux_global = array('docs_directory' => '../../../docs/' . $folder, 'valid_markdown_extensions' => array('md', 'markdown'));
if (file_put_contents('docs/global.json', json_encode($daux_global)) === FALSE) {
println('Error writing global conf in docs folder');
exit;
}
require_once 'vendor/justinwalsh/daux.io/libs/daux.php';
foreach (glob('docs/assets/templates/*') as $directory) {
if (strpos('.', $directory) < 0) {
@rmdir('vendor/justinwalsh/daux.io/templates/' . $directory);
}
}
//Copy alternative imgs, js and templates
directory_copy('docs/assets/templates', 'vendor/justinwalsh/daux.io/templates');
if (file_exists('docs/assets/' . $folder . '_img')) {
directory_copy('docs/assets/' . $folder . '_img', 'vendor/justinwalsh/daux.io/img');
}
$Daux = new \Todaymade\Daux\Daux(realpath('docs/global.json'));
$Daux->initialize();
if (!file_exists(PUBLICPATH . 'docs/' . $folder)) {
mkdir(PUBLICPATH . 'docs/' . $folder, 0777, TRUE);
}
$Daux->generate_static(PUBLICPATH . 'docs/' . $folder);
println('Docs generated in public folder');
}
示例7: log
public static function log($str)
{
if (X2_TEST_DEBUG_LEVEL > 0) {
/**/
println("\n[" . date('H:i:s', time()) . "] " . $str);
}
}
示例8: tearDownAfterClass
public static function tearDownAfterClass()
{
if (X2_TEST_DEBUG_LEVEL > 0) {
println("");
}
parent::tearDownAfterClass();
}
示例9: main
public static function main(array $args = array())
{
$gumballMachine = new GumballMachine(10);
println($gumballMachine);
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
println($gumballMachine);
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
println($gumballMachine);
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
println($gumballMachine);
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
println($gumballMachine);
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
$gumballMachine->insertQuarter();
$gumballMachine->turnCrank();
println($gumballMachine);
}
示例10: main
public static function main(array $args = array())
{
$foo = CoolerSingleton::getInstance();
$bar = HotterSingleton::getInstance();
println($foo);
println($bar);
}
示例11: prepare
public function prepare()
{
println("Preparing " . $this->name);
$this->dough = $this->ingredientFactory->createDough();
$this->sauce = $this->ingredientFactory->createSauce();
$this->cheese = $this->ingredientFactory->createCheese();
}
示例12: convert_dir
function convert_dir($dir, $echo = false)
{
$converted_files = array();
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != '.' && $entry != '..') {
$full = $dir . '/' . $entry;
if (is_dir($full)) {
$converted_files = array_merge($converted_files, convert_dir($full, $echo));
} else {
if (end(explode('.', $full)) == 'php') {
if (convert_file($full)) {
$converted_files[] = $full;
if ($echo) {
println("Converted: " . $full);
}
}
}
}
}
}
closedir($handle);
}
return $converted_files;
}
示例13: run
public function run($command = FALSE, $params = array())
{
$this->_loadCommands();
//read the params
//$params = func_get_args();
if ($command) {
$command_info = $this->_getInfoFunc($command);
if ($command_info) {
if (!isset($command_info['num_parameters']) || $command_info['num_parameters'] > count($params)) {
//shows helps
$this->help($command);
} else {
//Run the command
println('Running command: ' . $command);
println('');
call_user_func_array($command, $params);
println('');
}
} else {
println('Sorry the command ' . $command . ' doesn\'t exists');
println('');
}
} else {
println('I need the name of the command!!!');
println('');
}
}
示例14: select_account
function select_account()
{
$accounts = get_auth_keys();
//Show Account List
if (count($accounts) < 1) {
println("Please authenticate account.");
println("eg) php auth_request.php");
exit(1);
}
println("Please select the account.");
foreach ($accounts as $screen_name => $token) {
println(sprintf("@%s", $screen_name));
}
//input screen_name
echo ">@";
while (true) {
//input
$screen_name = strtolower(trim(read()));
//authenticate user check
if (!array_key_exists($screen_name, $accounts)) {
println("Please select the authenticated account");
echo ">@";
continue;
}
break;
}
return ["screen_name" => $screen_name, "access_token" => $accounts[$screen_name]["access_token_key"], "access_token_secret" => $accounts[$screen_name]["access_token_secret"]];
}
示例15: simulate
protected function simulate($duckFactoryOrQuackable)
{
if ($duckFactoryOrQuackable instanceof AbstractDuckFactory) {
$redheadDuck = $duckFactoryOrQuackable->createRedheadDuck();
$duckCall = $duckFactoryOrQuackable->createDuckCall();
$rubberDuck = $duckFactoryOrQuackable->createRubberDuck();
$gooseDuck = new GooseAdapter(new Goose());
println("\nDuck Simulator: With Composite - Flocks");
$flockOfDucks = new Flock();
$flockOfDucks->add($redheadDuck);
$flockOfDucks->add($duckCall);
$flockOfDucks->add($rubberDuck);
$flockOfDucks->add($gooseDuck);
$flockOfMallards = new Flock();
$mallardOne = $duckFactoryOrQuackable->createMallardDuck();
$mallardTwo = $duckFactoryOrQuackable->createMallardDuck();
$mallardThree = $duckFactoryOrQuackable->createMallardDuck();
$mallardFour = $duckFactoryOrQuackable->createMallardDuck();
$flockOfMallards->add($mallardOne);
$flockOfMallards->add($mallardTwo);
$flockOfMallards->add($mallardThree);
$flockOfMallards->add($mallardFour);
$flockOfDucks->add($flockOfMallards);
println("\nDuck Simulator: Whole Flock Simulation");
$this->simulate($flockOfDucks);
println("\nDuck Simulator: Mallard Flock Simulation");
$this->simulate($flockOfMallards);
println("\nThe ducks quacked " . QuackCounter::getQuacks() . " times");
} else {
if ($duckFactoryOrQuackable instanceof Quackable) {
$duckFactoryOrQuackable->quack();
}
}
}