本文整理汇总了PHP中Formatter::substring方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::substring方法的具体用法?PHP Formatter::substring怎么用?PHP Formatter::substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::substring方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ArtistsByAlbum
public static function ArtistsByAlbum($id)
{
$artists = AlbumArtistModel::model()->getArtistsByAlbum($id);
$i = 0;
$html = "";
foreach ($artists as $artist) {
$html .= $i > 0 ? "<span> - </span>" : "";
$html .= '<a href="' . URLHelper::buildFriendlyURL("artist", $artist->artist_id, Common::makeFriendlyUrl($artist->artist_name)) . '" title="' . $artist->artist_name . '">' . Formatter::substring($artist->artist_name, " ", 3, 15) . '</a>';
$i++;
}
return $html;
}
示例2: CHtmlPurifier
</div>
<div class="lyrics">
<h3 class='lyric-label'>
<i class='ic-lyric'></i>
<?php
echo Yii::t("wap", "Lyric");
?>
</h3>
<?php
$lyrics = $song->song_extra && $song->song_extra->lyrics ? $song->song_extra->lyrics : Yii::t("wap", "Lyric Updating");
$p = new CHtmlPurifier();
$p->options = array('HTML.ForbiddenElements' => array('div', 'span'));
$lyrics = $p->purify($lyrics);
$lyrics = str_replace("<br />", " ", $lyrics);
$lyrics = nl2br($lyrics);
$content = Formatter::substring($lyrics, " ", 50, 250);
?>
<?php
if (!empty($lyrics)) {
?>
<div class="lyrics-short-desc text-desc t10 fs_15">
<p class="pad-10 subtext"><?php
echo $content;
?>
</p>
<div class="short-desc-view-more">
<?php
if ($song->song_extra && $song->song_extra->lyrics) {
?>
<a href="javascript:void(0)"
示例3:
?>
">
<a href="<?php
echo $link;
?>
">
<img style="width: 120px;" src="<?php
echo AvatarHelper::getAvatar("artist", $artist->id, 120);
?>
" alt="<?php
echo $artist->name;
?>
" />
</a>
<p><a href="<?php
echo $link;
?>
" title="<?php
echo $artist->name;
?>
"><?php
echo Formatter::substring(CHtml::encode($artist->name), " ", 3, 12);
?>
</a></p>
</li>
<?php
}
}
?>
</ul>
</div>