http://www.cnblogs.com/gnuhpc/archive/2013/08/31/3293204.html
按照这篇文章一步一步走,可以实现在配置页面中配置username和password。
LUA的代码为
- m = Map("mycbi", "mycbi conf change interface")
- s = m:section(TypedSection, "MySection")
- s.addremove = true
- s:option(Value, "username", "Name:")
- key=s:option(Value, "password", "Password")
- key.password=true;
- return m
复制代码
根据LUCI官方文档的解释class Map (config, title, description)[size=0.8em]This is the root object of the model.
:section (sectionclass, ...)[size=0.8em]Creates a new section
m应该保存了配置文件mycbi中的所有section,s是在m中新建的一个section。
现如果我希望username是唯一的,应该怎么修改这段代码? 例如在配置中已经存在了 username = user1的section 如果再添加的section中username = user1,则提示出错,或者不保存。
|