Skip to content

Commit

Permalink
优化函数提升效率
Browse files Browse the repository at this point in the history
  • Loading branch information
jrotty authored Jan 26, 2021
1 parent d47941b commit 082abe7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion post/常用模板函数.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function get_post_view($archive)
$cid = $archive->cid;
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) {
if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')->page(1,1)))) {
$db->query('ALTER TABLE `' . $prefix . 'contents` ADD `views` INT(10) DEFAULT 0;');
echo 0;
return;
Expand Down

0 comments on commit 082abe7

Please sign in to comment.