本文整理汇总了PHP中Str::strip_html方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::strip_html方法的具体用法?PHP Str::strip_html怎么用?PHP Str::strip_html使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::strip_html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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'));
}
}
}