本文整理汇总了PHP中Helper::truncate_utf8_string方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::truncate_utf8_string方法的具体用法?PHP Helper::truncate_utf8_string怎么用?PHP Helper::truncate_utf8_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper::truncate_utf8_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$model = $this->controller->loadModel();
if (isset($_POST['Soft'])) {
$model->attributes = $_POST['Soft'];
//封面、图标、 文件
$model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
$model->soft_icon = isset($_POST['soft_icon']) ? $_POST['soft_icon'] : '';
$model->soft_file = isset($_POST['soft_file']) ? $_POST['soft_file'] : '';
//摘要
$model->introduce = trim($_POST['Soft']['introduce']) ? $_POST['Soft']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Soft']['content']), 200);
//标签 (前5个标签有效)
$tags = trim($_POST['Soft']['tags']);
$unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
$explodeTags = array_slice($unique_tags, 0, 5);
$model->tags = implode(',', $explodeTags);
$model->update_time = time();
if ($model->save()) {
$this->controller->message('success', Yii::t('admin', 'Update Success'), $this->controller->createUrl('index'));
}
}
$parents = Catalog::getParantsCatalog($model->catalog_id);
$catalog = Catalog::model()->findByPk($model->catalog_id);
$belong = $catalog ? implode('>', $parents) . '>' . $catalog->catalog_name : '';
$this->controller->render('update', array('model' => $model, 'parents' => $belong));
}
示例2: run
public function run()
{
$model = new Soft();
if (isset($_POST['Soft'])) {
$model->attributes = $_POST['Soft'];
//封面、图标、 文件
$model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
$model->soft_icon = isset($_POST['soft_icon']) ? $_POST['soft_icon'] : '';
$model->soft_file = isset($_POST['soft_file']) ? $_POST['soft_file'] : '';
//摘要
$model->introduce = trim($_POST['Soft']['introduce']) ? $_POST['Soft']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Soft']['content']), 200);
//标签 (前5个标签有效)
$tags = trim($_POST['Soft']['tags']);
$unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
$explodeTags = array_slice($unique_tags, 0, 5);
$model->tags = implode(',', $explodeTags);
$model->create_time = time();
$model->update_time = $model->create_time;
if ($model->save()) {
$this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
}
}
//判断有无栏目
$article_cat = Catalog::model()->find('type=:type', array(':type' => $this->controller->_type));
if (!$article_cat) {
$this->controller->message('error', Yii::t('admin', 'No Catalog'), $this->controller->createUrl('index'));
}
$this->controller->render('create', array('model' => $model));
}
示例3: array
?>
</td>
<td><?php
echo $row['brand_en_name'];
?>
</td>
<td><?php
echo $row['country_cn_name'];
?>
</td>
<td><img src="<?php
echo Yii::app()->params['imgurl'] . $row['brand_logo'];
?>
" width="50" height="50"></td>
<td><?php
echo Helper::truncate_utf8_string($row['brand_desc'], 20);
?>
</td>
<td><?php
echo $row['brand_status'] ? yii::t('vcos', '启用') : yii::t('vcos', '禁用');
?>
</td>
<td>
<?php
$this->widget('ManipulateWidget', array('ControllerName' => 'Brand', 'MethodName' => 'brand_edit', 'id' => $row['brand_id'], 'canedit' => $canedit, 'candelete' => $candelete));
?>
</td>
</tr>
<?php
}
?>
示例4:
echo $row['activity_id'];
?>
" class="ace isclick" />
<span class="lbl"></span>
</label>
</td>
<td><?php
echo ++$key;
?>
</td>
<td><?php
echo $row['activity_name'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($row['activity_desc'], 20);
?>
</td>
<td><?php
echo $row['start_time'];
?>
</td>
<td><?php
echo $row['end_time'];
?>
</td>
<td><?php
echo $row['status'] ? yii::t('vcos', '启用') : yii::t('vcos', '禁用');
?>
</td>
<td><?php
示例5: array
echo $row['id'];
?>
" class="ace isclick" />
<span class="lbl"></span>
</label>
</td>
<td><?php
echo ++$key;
?>
</td>
<td><?php
echo $row['product_name'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($row['graphic_desc'], 20);
?>
</td>
<td><?php
echo $row['sort_order'];
?>
</td>
<td><img src="<?php
echo Yii::app()->params['imgurl'] . $row['img_url'];
?>
" width="50" height="50"></td>
<td>
<?php
$this->widget('ManipulateWidget', array('ControllerName' => 'Product', 'MethodName' => 'product_graphic_edit', 'id' => $row['id'], 'canedit' => $canedit, 'candelete' => $candelete));
?>
</td>
示例6: array
echo $row['product_detail_id'];
?>
" class="ace isclick" />
<span class="lbl"></span>
</label>
</td>
<td><?php
echo ++$key;
?>
</td>
<td><?php
echo $row['product_name'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($row['text_detail'], 20);
?>
</td>
<td>
<?php
$this->widget('ManipulateWidget', array('ControllerName' => 'Product', 'MethodName' => 'product_detail_edit', 'id' => $row['product_detail_id'], 'canedit' => $canedit, 'candelete' => $candelete));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</form>
<div class="center">
示例7:
echo $row['id'];
?>
" class="ace isclick" />
<span class="lbl"></span>
</label>
</td>
<td><?php
echo ++$key;
?>
</td>
<td><?php
echo $row['category_name'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($count, 30);
?>
</td>
<td><?php
echo $row['sort_order'];
?>
</td>
<td><img src="<?php
echo Yii::app()->params['imgurl'] . $row['img_url'];
?>
" width="50"/></td>
<td><?php
echo $row['state'] ? yii::t('vcos', '启用') : yii::t('vcos', '禁用');
?>
</td>
<td>
示例8:
?>
</td>
<td><?php
echo $row['ls_title'];
?>
</td>
<td><?php
echo $row['booking_time'];
?>
</td>
<td><?php
echo $row['booking_num'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($row['remark'], 30);
?>
</td>
<td><?php
echo $row['is_read'] ? yii::t('vcos', '已读') : yii::t('vcos', '未读');
?>
</td>
<td>
<select class="col-xs-10 col-sm-8 col-md-8 state" name="state" id="<?php
echo $row['id'];
?>
" title="<?php
echo $row['state'];
?>
">
<?php
示例9: foreach
</a></dd>
<?php
}
?>
</dl>
<dl class="category recent_post">
<dt><?php
echo Yii::t('common', 'Last Goods');
?>
</dt>
<?php
foreach ((array) $last_goods as $ls) {
?>
<dd><a title="<?php
echo CHtml::encode($ls->goods_name);
?>
" href="<?php
echo $this->createUrl('goods/view', array('id' => $ls->id));
?>
"><?php
echo Helper::truncate_utf8_string($ls->goods_name, 18);
?>
</a></dd>
<?php
}
?>
</dl>
</div>
示例10: actionUpdate
/**
* 更新
*
* @param $id
*/
public function actionUpdate($id)
{
$model = Post::model()->findByPk($id);
if (isset($_POST['Post'])) {
$model->attributes = $_POST['Post'];
//标题样式
$title_style = $this->_request->getPost('style');
if ($title_style['bold'] != 'Y') {
unset($title_style['bold']);
}
if ($title_style['underline'] != 'Y') {
unset($title_style['underline']);
}
if (!$title_style['color']) {
unset($title_style['color']);
}
if ($title_style) {
$model->title_style = serialize($title_style);
} else {
$model->title_style = '';
}
if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) {
//封面图片
$upload = new Uploader();
$upload->_thumb_width = 100;
$upload->_thumb_height = 100;
$upload->uploadFile($_FILES['attach'], true);
if ($upload->_error) {
$upload->deleteFile($upload->_file_name);
$upload->deleteFile($upload->_thumb_name);
$this->message('error', Yii::t('admin', $upload->_error));
return;
}
$model->attach_file = $upload->_file_name;
$model->attach_thumb = $upload->_thumb_name;
} else {
//未改变前的封面图片
$model->attach_file = $_POST['old_file'];
$model->attach_thumb = $_POST['old_thumb'];
}
//组图
$imageList = $this->_request->getPost('imageList');
$imageListSerialize = $this->imageListSerialize($imageList);
$model->image_list = $imageListSerialize['dataSerialize'];
//标签 (前10个标签有效)
$tags = trim($_POST['Post']['tags']);
$explodeTags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
$explodeTags = array_slice($explodeTags, 0, 10);
//摘要
$model->introduce = trim($_POST['Post']['introduce']) ? $_POST['Post']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Post']['content']), 200);
$model->tags = implode(',', $explodeTags);
$model->update_time = time();
if ($model->save()) {
//更新标签数据
Tag::model()->updateTagData($explodeTags, array('content_id' => $model->id, 'status' => $model->status, 'type_id' => $this->_type_ids['post']));
$this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index'));
}
} else {
$imageList = unserialize($model->image_list);
$style = unserialize($model->title_style);
}
$this->render('update', array('model' => $model, 'imageList' => $imageList, 'style' => $style));
}
示例11:
?>
</td>
<td><?php
echo $row['comment_type_name'];
?>
</td>
<td><?php
echo $row['cn_name'];
?>
</td>
<td><?php
echo $row['comment_time'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($row['comment_content'], 20);
?>
</td>
<td>
<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
<a href="<?php
echo Yii::app()->createUrl("Commentandhelp/user_comment_detail?id={$row['comment_id']}");
?>
" class="btn btn-xs btn-success" title="<?php
echo yii::t('vcos', '查看详情');
?>
">
<i class="icon-zoom-in bigger-120"></i>
</a>
</div>
<div class="visible-xs visible-sm hidden-md hidden-lg">
示例12: foreach
foreach ((array) $video_hot as $vh) {
?>
<li>
<a href="<?php
echo $this->createUrl('video/view', array('id' => $vh->id));
?>
" class="video_a">
<img width="150" height="200" src="<?php
echo $vh->cover_image;
?>
" />
<span class="v_play_mask"></span>
<span class="v_play_icon"></span>
</a>
<span class="video_title"><?php
echo Helper::truncate_utf8_string($vh->title, 8);
?>
</span>
</li>
<?php
}
?>
</ul>
</div>
</div>
<?php
}
?>
<!-- 推荐教程区结束 -->
示例13: foreach
"><?php
echo Yii::t('common', 'More');
?>
</a></dd>
</dl>
<dl class="category recent_post">
<dt><?php
echo Yii::t('common', 'Last Articles');
?>
</dt>
<?php
foreach ((array) $last_posts as $lp) {
?>
<dd><a title="<?php
echo CHtml::encode($lp->title);
?>
" href="<?php
echo $this->createUrl('post/view', array('id' => $lp->id));
?>
"><?php
echo Helper::truncate_utf8_string($lp->title, 18);
?>
</a></dd>
<?php
}
?>
</dl>
</div>
示例14: array
?>
>
<td >
<?php
echo $row->id;
?>
</td>
<td >
<a href="<?php
echo $this->createUrl('/goods/view', array('id' => $row['goods_id']));
?>
" title="<?php
echo $row->plan_name;
?>
" target="_blank"><?php
echo Helper::truncate_utf8_string($row->plan_name, 20);
?>
</a><br />
</td>
<td ><?php
echo $row->goods->goods_name;
?>
</td>
<td ><?php
echo $row->plan_price;
?>
</td>
<td ><?php
echo date('Y-m-d H:i', $row->create_time);
?>
示例15: foreach
</thead>
<tbody>
<?php
foreach ($port as $key => $row) {
?>
<tr>
<td><?php
echo ++$key;
?>
</td>
<td><?php
echo $row['port_name'];
?>
</td>
<td><?php
echo Helper::truncate_utf8_string($row['describe'], 30);
?>
</td>
<td><img src="<?php
echo Yii::app()->params['imgurl'] . $row['img_url'];
?>
" width="50"/></td>
<td><?php
echo $row['port_state'] ? yii::t('vcos', '启用') : yii::t('vcos', '禁用');
?>
</td>
<td>
<?php
//操作挂件
$this->widget('ManipulateWidget', array('ControllerName' => 'Cruiseinfo', 'MethodName' => 'port_edit', 'id' => $row['port_id'], 'canedit' => $canedit, 'candelete' => $candelete));
?>