开发者

Should I use a table here or hard code values in a config file?

开发者 https://www.devze.com 2023-02-06 00:56 出处:网络
I need to set up different user roles i.e:开发者_如何学编程 1-administrator 2-writer 3-member I was wondering whether I should make a dedicated table for user roles i.e just to store the names and i

I need to set up different user roles i.e:开发者_如何学编程

1-administrator 2-writer 3-member

I was wondering whether I should make a dedicated table for user roles i.e just to store the names and ids i.e:

USER ROLES
ID | NAME 

Or would it be ok if I were to just put the values in a config file as an associative array i.e:

$config['roles'] = array(1=>'Administrator'...);

Considering that I just need to store an id and a name here?


Absolutely use the database table if this is a production app. You will thank yourself later if you want to turn over administration to someone else.

0

精彩评论

暂无评论...
验证码 换一张
取 消