本文整理汇总了PHP中Str::slice方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::slice方法的具体用法?PHP Str::slice怎么用?PHP Str::slice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::slice方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
echo $item['article_id'];
?>
.html"><?php
echo Str::strip_html($item['title']);
?>
</a>
<span class="time"><?php
echo date('Y-m-d', $item['post_date']);
?>
</span>
<span>阅读:<?php
echo $item['views'];
?>
</span>
<p><?php
echo Str::slice(Str::strip_html($item['content']), 100, '..');
?>
<p>
</li>
<?php
}
?>
</ul>
<div class="page_list"> <?php
echo $pagination->render('pagination/digg');
?>
</div>
</div>
</div>
示例2: round
" /></td>
<td><?php
echo $item['id'];
?>
</td>
<td align="left"><a href="/src_csv/<?php
echo $item['uid'];
?>
/<?php
echo $item['src_file'];
?>
" title="<?php
echo $item['csv_file'];
?>
" target="_blank"><?php
echo Str::slice($item['csv_file'], 30, '..');
?>
</a></td>
<td align="left"><?php
echo round($item['freesize'] / 1024);
?>
KB</td>
<td><a href="/dest_csv/<?php
echo $item['uid'];
?>
/<?php
echo $item['dest_file'];
?>
" title="<?php
echo $item['dest_file'];
?>
示例3: foreach
</ul>
<div class="fold">
<div class="tags_title">
<h2>热门标签</h2>
<sup>HOTTAGS</sup>
</div>
</div>
<ul class="tags_lists">
<?php
foreach ($tags as $item) {
?>
<li><a href="/book/search?tags=<?php
echo $item;
?>
"><?php
echo Str::slice($item, 10);
?>
</a></li>
<?php
}
?>
</ul>
<div class="clearfloat"></div>
</div>
<div class="ft"></div>
<a class="ad1" href="#">
<img src="/images/album/banner/banner3.png" width="250" height="70" border="0" alt="" title="" />
</a>
</div>
</div>
</div>
示例4: date
?>
</a>
</td>
<td align="left"><?php
echo date('Y-m-d H:i:s', strtotime($item['submit_date']));
?>
</td>
<td align="left"><?php
echo Str::slice($item['title'], 20, '...');
?>
</td>
<td align="left"><a href="<?php
echo $item['url'];
?>
" target="_blank"><?php
echo Str::slice($item['url'], 20, '...');
?>
</a></td>
<td ><?php
echo $status;
?>
</td>
<td align="left"><?php
echo !empty($item['audite_date']) ? date('Y-m-d H:i:s', strtotime($item['audite_date'])) : '';
?>
</td>
<td align="left">
<?php
if ($item['status'] > 0) {
echo '<font color="red">' . $item['points'] . '</font>';
} else {
示例5: date
.html" target="photo">
<img src="<?php
echo URL::domain() . Str::changeLoad($thumb->create($item['img_dir'] . '/' . $item['picname'], 130, 130));
?>
" />
</a>
<span class="info">
<a class="photo_id" href="/<?php
echo $item['id'];
?>
.html" title="<?php
echo $item['custom_name'];
?>
"target="photo"><?php
echo Str::slice($item['custom_name'], 15, '...');
?>
</a><br />
会员:<?php
echo ORM::factory('user', $item['userid'])->username;
?>
<br />
上传时间:<?php
echo date('Y-m-d', $item['uploadtime']);
?>
</span>
</li>
<?php
}
示例6: foreach
<div class="title">
<h2><span class="icon"></span>热门文章</h2>
<sup>+Popular Article</sup> </div>
<br/>
<ul class="new">
<?php
foreach ($hot_list as $item) {
?>
<li><span class="time"><?php
echo date('Y-m-d', $item->post_date);
?>
</span><a href="/articles/<?php
echo $item->article_id;
?>
.html"><?php
echo Str::slice($item->title, 20, '...');
?>
</a></li>
<?php
}
?>
</ul>
<div class="clearfloat"></div>
</div>
</div>
</div>
<script type="text/javascript">
$().ready(function(){
d.openAll();
});
</script>
示例7: return_data
public function return_data($item)
{
if (!is_array($item)) {
return '<li>这是最后一张</li>';
}
$str = '';
$str .= '<li><p><a class="photo" href="/' . $item['id'] . '.html"> <img src="' . URL::domain() . Str::changeLoad($this->thumb->create($item['img_dir'] . '/' . $item['picname'], 65, 65)) . '" alt="查看图片详情" border="0" /> </a></p>';
$str .= '<p><a class="photo_id" href="/' . $item['id'] . '.html" title="查看">' . Str::slice($item['custom_name'], 10, '..') . '</a></p><p>浏览' . $item['click'] . '次</p></li>';
return $str;
}
示例8:
#slider1 .buttons {background:url("/images/album/img/icon.png") no-repeat scroll -167px 0 transparent; display: block; margin:0px 10px 0 0; background-position: 0 -38px; text-indent: -999em; float: left; width: 39px; height: 37px; position: absolute;overflow: hidden; }
#slider1 .next { background:url("/images/album/img/icon.png") no-repeat scroll -151px 0 transparent;float:right; margin: 70px 0 0 296px;+margin: 70px 0 0 5px; width:18px }
#slider1 .prev {background:url("/images/album/img/icon.png") no-repeat scroll -167px 0 transparent;margin: 90px 0 0 0px; width:17px;}
#slider1 .disable { visibility: hidden; }
#slider1 .overview { list-style: none; padding: 0; width: 480px; margin: 0 2px 0px 10px; }
#slider1 .overview li{ float: left; margin: 0 5px 0 0px; padding: 1px; height: 131px; width: 84px;}
#slider1 .overview li .photo {-moz-box-shadow:3px 3px 10px -4px #AAAAAA;background:none repeat scroll 0 0 #FFFFFF;border:1px solid #E9EBEA;display:block;height:72px;margin-bottom:5px;padding:2px;width:72px;margin-left:2px;margin-top:5px;}
#slider1 table{color:#50B004;margin:5px 0 0 10px;}
</style>
<div id="slider1">
<a class="buttons prev" href="#" id="prev_pic">left</a>
<table>
<tr>
<td>相册名:</td>
<td><h2><?php
echo Str::slice($imgInfo['cate_name'], '15', '...');
?>
</h2></td>
<td></td>
</tr>
</table>
<div class="viewport">
<ul class="overview" id="other_list">
</ul>
</div>
<a class="buttons next" href="#" id="next_pic">right</a>
</div>
<?php
if ($auth) {
示例9: urlencode
<li>
<a class="avatar" href="/u/<?php
echo urlencode($item['username']);
?>
">
<img src="<?php
echo !empty($item['avatar']) ? $item['avatar'] : '/images/album/no_avatar.png';
?>
" border="0" alt="" width="80" height="80"/>
</a>
<a class="name" href="/u/<?php
echo urlencode($item['username']);
?>
">
<?php
echo Str::slice($item['username'], 8);
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<div class="login">
<div class="banner"><a href="/user/register"><img alt="永久免费" src="/images/user/login_bannber.gif" /></a></div>
<br />
<script language="javascript" src="/js"></script>
</div>
<?php
示例10: foreach
<?php
foreach ($pagination as $key => $item) {
?>
<tr>
<td class="td_hd"><span class="icon"></span><?php
echo $key + 1;
?>
</td>
<td width="200"><a href="/articles/<?php
echo $item['article_id'];
?>
.html" title="查看 <?php
echo $item['title'];
?>
" target="_blank"><?php
echo Str::slice($item['title'], 20, '...');
?>
</a></td>
<td width="70"><a href="/book/article/list?cate_id=<?php
echo $item['cate_id'];
?>
" title="查看<?php
echo $item['cate_name'];
?>
下的图书 "><?php
echo isset($item['cate_name']) ? $item['cate_name'] : '我的图书馆';
?>
</a></td>
<td><?php
echo date('Y-m-d H:i:s', $item['post_date']);
?>
示例11: action_add
/**
* 图书添加
*/
public function action_add()
{
$this->checkLogin();
$this->_add_css('styles/album/edit_articles.css');
$this->template->pageTitle = '添加图书';
$this->template->categories = $categories = $this->cate->getCates($this->auth['uid']);
$article = ORM::factory('article');
if ($this->isPost()) {
//数据验证
$post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('cate_id', 'not_empty')->rule('content', 'not_empty');
if ($post->check()) {
preg_match_all("/(src)=[\"|'| ]{0,}((https?\\:\\/\\/.*?)([^>]*[^\\.htm]\\.(gif|jpg|bmp|png)))/i", $this->getPost('content'), $match);
$img = preg_replace("/^http:\\/\\/[\\w\\.\\-\\_]*wal8\\.com\\//i", '', $match[2][0]);
$article->thumb = $img;
$article->excerpt = Str::slice(Str::strip_html($this->getPost('content')), 30, '...');
$article->uid = $this->auth['uid'];
$article->userip = Request::$client_ip;
$aid = $article->values($post)->save();
$tags = trim($this->getPost('tags'));
$tags = explode(' ', $tags);
$this->tag->add($aid, 'article', $tags, $this->auth['uid']);
$select = DB::select(DB::expr("count(0)"))->from('articles')->where('cate_id', '=', $post['cate_id']);
DB::update('article_categories')->set(array('art_num' => $select))->where('cate_id', '=', $post['cate_id'])->execute();
$links[] = array('text' => '图书管理', 'href' => '/book/article/list');
$this->show_message('添加图书成功', 1, $links, true);
} else {
$this->show_message($post->errors('book/article'));
}
}
}