srtfisher/ codeigniter-features
此包已被废弃,不再维护。未建议替代包。
Codeigniter 特性标志
0.5
2012-12-04 00:08 UTC
Requires
- php: >=5.2
This package is auto-updated.
Last update: 2022-06-25 01:36:30 UTC
README
为选定用户启用特性是一种既有趣又高效的开发新特性的方法。您可以根据多个因素启用特性,或某些代码部分的特定功能。有关更多信息,请查看 config/features.php。
设置
在使用此包的用户ID部分之前,您需要设置当前用户的ID。您可以通过以下方式完成: $this->feature->set_user($the_user_id);
使用标志
设置标志很简单。我们包含了一个辅助函数来测试当前用户是否有该特性,以简化您的操作!只需使用以下代码:
<?php
if (can_do_feature('the_feature_name'))
{
// The code to execute if they can perform a feature
}
?>