如何在CodeIgniter中仅为少数控制器而不是所有控制器调用挂钩?
例如:我想只为admin部分运行钩子.我怎样才能做到这一点?
我正在使用WordPress插件WP-PostViews来显示帖子的视图数量。我正在使用此代码,它很好用:
<?php if(function_exists('the_views')) { the_views(); }?>
Run Code Online (Sandbox Code Playgroud)
我想做的是将一定数量的帖子视图用作变量,但是我无法使其正常工作。到目前为止,我已经尝试过:
<?php if(function_exists('the_views')) { $variable = the_views(); } ?>
Run Code Online (Sandbox Code Playgroud)
和
<?php if(function_exists('the_views')) { $variable = the_views(); } else { $var = 0; } ?>
Run Code Online (Sandbox Code Playgroud)
到目前为止没有成功。有人有建议吗?