本文整理汇总了PHP中StringHelper::substr方法的典型用法代码示例。如果您正苦于以下问题:PHP StringHelper::substr方法的具体用法?PHP StringHelper::substr怎么用?PHP StringHelper::substr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringHelper
的用法示例。
在下文中一共展示了StringHelper::substr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getShortDescription
public function getShortDescription()
{
$Str = new StringHelper();
return $Str->substr($this->description, 0, 65);
}
示例2: getShortName
public function getShortName()
{
$str = new StringHelper();
return $str->substr($this->name, 0, 50);
}
示例3: getTinyNotes
public function getTinyNotes()
{
$str = new StringHelper();
return $str->substr($this->notes, 0, 15);
}
示例4: nl2br
<?php
/* @var $this SiteController */
$this->pageTitle = $model->title;
$sh = new StringHelper();
FbUtils::AddMetaTags('DE-PTI - ' . $model->title, Yii::app()->params["domain"] . 'de-pti', $sh->substr($model->contents, 0, 60));
$FacebookUrl = Yii::app()->params['domain'] . Yii::App()->createUrl("site/showNews", array("id" => $data->news_id));
?>
<div class="container">
<div class="row">
<div class="col-xs-12 text-align-justify">
<p><?php
print nl2br($model->contents);
?>
</p>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h3>Várjuk a véleményedet!</h3>
<div class="text-align-center">
<div class="fb-comments" data-width="690" data-href="<?php
print $FacebookUrl;
?>
" data-numposts="5" data-colorscheme="light"></div>
</div>
</div>
</div>
</div>
示例5: date
<h4 class="timeline-title">
<?php
print CHtml::link($data->title, array('site/showNews', 'id' => $data->news_id));
?>
</h4>
<p>
<small class="text-muted">
<i class="fa fa-clock-o"></i>
<?php
$str = new StringHelper();
print date('Y. m. d. H:i', strtotime($data->date_created));
if ($data->date_created != $data->date_updated) {
print " (módosítva: " . date('Y. m. d. H:i', strtotime($data->date_updated)) . ")";
}
if ($data->subject_id != null) {
$SubjName = $str->substr($data->subject->name, 0, 50);
print ' - ' . CHtml::link($SubjName, array('subject/details', 'id' => $data->subject->subject_id));
}
print ' - <b>' . $data->user->username . '</b>';
?>
</small>
</p>
<?php
if (Yii::app()->user->getId() && Yii::app()->user->level >= 1) {
print '<p><div class="btn-group">';
print CHtml::link('<i class="fa fa-edit"></i> Módosítás', Yii::app()->createUrl("site/editnews", array('id' => $data->news_id)), array('class' => 'btn btn-sm btn-primary'));
print sprintf('<a onclick="DeleteNews(\'%s\')" class="btn btn-sm btn-danger">
<i class="fa fa-trash-o"></i>
Törlés
</a>', Yii::app()->createUrl("site/deletenews", array('id' => $data->news_id)));
print '</div></p>';