本文整理汇总了PHP中Strings::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Strings::format方法的具体用法?PHP Strings::format怎么用?PHP Strings::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::format方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extensions
public static function extensions($names)
{
$missing = array();
foreach ($names as $name) {
if (!extension_loaded($name)) {
$missing[] = $name;
}
}
if (count($missing) > 0) {
throw new Exception(Log::err(sprintf("Missing required extension(s): %s", Strings::format($missing))));
}
}
示例2: regionName
private static function regionName($regionIndex)
{
$html = "<span class='m-wrap'>{{name}}</span>";
$region = SysRegion::findFirst("sys_region_index={$regionIndex}");
$regionName = '';
if ($region) {
$regionName = $region->sys_region_name;
}
return Strings::format($html, array('name' => $regionName));
}
示例3: prepareNetworkmap
private static function prepareNetworkmap($networkmap)
{
$sourceKey = Strings::format($networkmap->getSourceNames());
if (!isset(self::$sNetworkmapIndex[$sourceKey])) {
foreach ($networkmap->getNetworks() as $network) {
$networkName = $network->getName();
$networkType = $network->getType();
switch ($networkType) {
case MonitorNetwork::TYPE_INET:
case MonitorNetwork::TYPE_INET6:
self::prepareNetworkmapInet($sourceKey, $network);
break;
case MonitorNetwork::TYPE_IFCONFIG:
self::prepareNetworkmapIfconfig($sourceKey, $network);
break;
default:
throw new Exception(Log::err("Unknown network type '{$networkType}' for network '{$networkName}'"));
}
}
}
}