我学习了 在PHP里面调用SH 这样后面可以做很多事情 比如UI控制LED 本质是HTML-PHP-SH这样的
现在想做读写
我看system advance
if (isset($_POST['RestartLighttpd'])) {
$status->addMessage('Restarting lighttpd in 3 seconds...', 'info');
exec('sudo /etc/raspap/lighttpd/configport.sh --restart');
}
exec('cat '. RASPI_LIGHTTPD_CONFIG, $return);
$conf = ParseConfig($return);
$serverPort = $conf['server.port'];
$serverBind = str_replace('"', '',$conf['server.bind'
它这里是执行cat命令 拿到文本 在去解析出ParseConfig
但是好像需要= 我是JS暂时放弃吧
exec("cat /tmp/config.json", $return);
这样就读文本 就在 return
而我没有后面的解析 就直接吧
1---
exec('cat '. RASPI_LIGHTTPD_CONFIG, $return);
$conf = ParseConfig($return);
$serverPort = $conf['server.port'];
$serverBind = str_replace('"', '',$conf['server.bind']);
exec("cat /tmp/config.json", $koson1);
2---
<!-- advanced tab -->
<div role="tabpanel" class="tab-pane" id="advanced">
<h4 class="mt-3"><?php echo _("Advanced settings") ;?></h4>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<form action="system_info" method="POST">
<?php echo CSRFTokenFieldTag() ?>
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("Web server port") ;?></label>
<input type="text" class="form-control" name="serverPort" value="<?php echo htmlspecialchars($serverPort, ENT_QUOTES); ?>" />
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("Web server bind address") ;?></label>
<input type="text" class="form-control" name="serverBind" value="<?php echo htmlspecialchars($serverBind, ENT_QUOTES); ?>" />
</div>
</div>
<input type="submit" class="btn btn-outline btn-primary" name="SaveServerSettings" value="<?php echo _("Save settings"); ?>" />
<input type="submit" class="btn btn-warning" name="RestartLighttpd" value="<?php echo _("Restart lighttpd"); ?>" />
<div class="row">
<div class="form-group col-md-6">
<label for="code"><?php echo _("koson1") ;?></label>
<input type="text" class="form-control" name="koson1" value="<?php echo $koson1; ?>" />
</div>
</div>
</form>
<?php endif ?>
</div>
|