本文整理匯總了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'));
}
}
}