本文整理汇总了PHP中Output::display方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::display方法的具体用法?PHP Output::display怎么用?PHP Output::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::display方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Output
<?php
require_once 'output.php';
require_once 'square.php';
require_once 'cube.php';
require_once 'fourth.php';
$input = 10;
$output = new Output(new Square());
echo $output->display($input);
$output->setStrategy(new Cube());
echo $output->display($input);
$output->setStrategy(new Fourth());
echo $output->display($input);
示例2: Output
<?php
include_once 'output.php';
include_once 'square.php';
include_once 'cube.php';
include_once 'rectangle.php';
$inputA = 10;
$inputB = 20;
$output = new Output(new Square());
echo $output->display($inputA) . '<br>';
$output->setStrategy(new Cube());
echo $output->display($inputA) . '<br>';
$output->setStrategy(new Rectangle());
echo $output->display($inputA, $inputB) . '<br>';
示例3: call_user_func
}
// instantiate the controller (and run its constructor)
$class = Core::controller($class);
// Call the remapping function if it's present in the controller
if (method_exists($class, '_remap')) {
call_user_func(array($class, '_remap'));
} else {
if (!method_exists($class, $method)) {
Core::error404($uri);
}
// Call the requested method. Any URI segments present
// (besides the controller/action) will be passed to the method for convenience
call_user_func_array(array($class, $method), array_slice(Uri::routedsegments(), 2));
}
// send final output
Output::display();
}
// ------------------------------------------------------------- Support Functions
function urlpath($url)
{
return str_replace(URL, ROOT, $url);
}
function rmroot($path)
{
return str_replace(ROOT, '', $path);
}
function error($msg)
{
unlink(TMP . 'system.chk');
die("<h1 style='color:#900'>{$msg}</h1>");
}
示例4: setSize
{
$this->color = $color;
}
function setSize($size)
{
$this->size = $size;
}
}
class Output
{
var $lookandfeel;
var $output;
// Constructor takes LookAndFeel as its argument
function Output($lookandfeel)
{
$this->lookandfeel = $lookandfeel;
}
function buildOutput()
{
$this->output = 'Color is ' . $this->lookandfeel->getColor() . ' and size is ' . $this->lookandfeel->getSize();
}
function display()
{
$this->buildOutput();
return $this->output;
}
}
$lookandfeel = new LookAndFeel();
$output = new Output($lookandfeel);
echo $output->display();