本文整理汇总了PHP中Container::number方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::number方法的具体用法?PHP Container::number怎么用?PHP Container::number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::number方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
// accessing and changing providers as property
echo '<div class="subtitle">2. part</div>';
$container->book = "Lord of the flies 2";
echo $container->book . '<br>';
echo $container->now . '<br>';
echo implode(' ', $container->numbers) . '<br>';
// accessing and changing providers as array
echo '<div class="subtitle">3. part</div>';
$container["book"] = "Lord of the flies 3";
echo $container["book"] . '<br>';
echo $container["now"] . '<br>';
echo implode(' ', $container["numbers"]) . '<br>';
// accessing providers as function
echo '<div class="subtitle">4. part</div>';
echo $container->book() . '<br>';
echo $container->number() . '<br>';
echo $container->now() . '<br>';
echo $container->hello("John", "Doe") . '<br>';
// singleton access
echo '<div class="subtitle">5. part</div>';
$dsn = "mysql:host=localhost;dbname=newsletter;charset=utf8";
// Host name and database name
$user = "root";
// MySQL user name
$pass = "root";
// MySQL password
$container->set("db", function ($dsn, $user, $pass) {
return new \PDO($dsn, $user, $pass);
}, true);
$db_data = array($dsn, $user, $pass);
try {
示例2: function
// Prints now date ("August 23, 2015, 7:28 am")
echo "<br>";
$container["book"] = "Lord of the flies 3";
echo "<br>";
echo $container['book'];
// Prints "Lord of the flies 3"
echo "<br>";
echo $container['now'];
// Prints now date ("August 23, 2015, 7:28 am")
echo "<br>";
echo "---------------------------------------******************************************************************-------------------------------------------";
echo "<br>";
echo $container->book();
// Prints "Lord of the flies"
echo "<br>";
echo $container->number();
// Prints 317
echo "<br>";
echo $container->now();
// Prints now date ("August 23, 2015, 7:28 am")
echo "<br>";
echo $container->hello("John", "Doe");
// Prints "Hello John Doe"
$container->set("db", function ($dsn, $user, $pass) {
return new \PDO($dsn, $user, $pass);
}, true);
//$db = $container->get("db"); // Always returns the same instance
$container->set("MAX_BUFFER_SIZE", 200, true);
$container->set("hash", function () {
return md5(gethostname() . time());
}, true);