本文整理匯總了PHP中ArticleModel::getAllArticleInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleModel::getAllArticleInfo方法的具體用法?PHP ArticleModel::getAllArticleInfo怎麽用?PHP ArticleModel::getAllArticleInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArticleModel
的用法示例。
在下文中一共展示了ArticleModel::getAllArticleInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setArticleTagUseNumber
public function setArticleTagUseNumber()
{
$articleModel = new ArticleModel();
$articleTagModel = new ArticleTagModel();
$articles = $articleModel->getAllArticleInfo();
$tags = $articleTagModel->getArticleTag();
//初始化
$tagId = array();
foreach ($tags as $v) {
$tagId[] = $v['tagId'];
}
foreach ($tagId as $v) {
$articleTagModel->updateArticleTagByTagId($v, array('useNumber' => 0));
}
//執行統計
$arr = array();
foreach ($articles as $v) {
$tagArr = explode(',', trim($v['tagId'], ','));
foreach ($tagArr as $v) {
$arr[] = $v;
}
}
$useNumber = array_count_values($arr);
foreach ($useNumber as $k => $v) {
if ($k != '') {
$data['useNumber'] = $v;
$row[] = $articleTagModel->updateArticleTagByTagId($k, $data);
}
}
}