OpenWrt的luci web管理器添加新菜单(四)

和OpenWrt的luci web管理器添加新菜单(三)

本文将记录如何实现按键重启路由的功能

步骤一:

在/usr/lib/lua/luci/controller/admin/new_tab.lua 文件中加入如下内容:

entry({"admin", "new_tab", "reboot"}, cbi("admin_myapp/reboot"), _("Reboot"), 4)步骤二:

添加/usr/lib/lua/luci/model/cbi/admin_myapp/reboot.lua文件:

— Copyright 2008 fulinux <fulinux@sina.com>– Licensed to the public under the Apache License 2.0.m = Map("button", translate("Reboot"), translate("reboot system"))s = m:section(TypedSection, "reboot", "Part reboot of the form")s.addremove = falses.anonymous = truebutton = s:option(Button, "_button", "Reboot")button.inputtitle = translate("Reboot")button.inputstyle = "apply"function button.write(self, section, value)s:option(DummyValue, "Reboot", "reboot…")luci.sys.call("reboot")ends.optional=false; s.rmempty = false;return m步骤三:

添加/etc/config/button文件:

config reboot

作品展示:

版权声明:本文为博主原创文章,未经博主允许不得转载。

,自己喜欢的人,那就随便怎么样了,

OpenWrt的luci web管理器添加新菜单(四)

相关文章:

你感兴趣的文章:

标签云: