我希望通过使用mikrotik检索mikrotik PPPoE服务器服务名称列表,并通过选择菜单循环所有服务名称。我自己做过密码。代码如下所示:
$ctype =$this->uri->segment('3');
if($ctype=='PPP')
{
  if ($this->routerosapi->connect('1.1.1.1', 'xxx', 'xxx')) 
  {
    $this->routerosapi->write('/interface/pppoe-server/getall');
    $READ = $this->routerosapi->read(false);
    $mktserver= $this->routerosapi->parseResponse($READ);  
    $this->routerosapi->disconnect();
  }
}
elseif($ctype=='HSP')
{
  if ($this->routerosapi->connect('xxx', 'xxx', 'xxx')) 
  {
    $this->routerosapi->write('/ip/hotspot/server/getall');
    $READ = $this->routerosapi->read(false);
    $mktserver= $this->routerosapi->parseResponse($READ);  
    $this->routerosapi->disconnect();
  }
}  
<p>
    <label for="simple-required">Server</label>
    <select name="server" id="server" class="full-width">
    <?php foreach($mktserver as $item):?>
    <option value="<?php echo $item['service-name'];?>"><?php echo $item['service-name'];?></option>
    <?php endforeach;?>
</select>
</p>我做错了什么?
注:
请在你的回答中具体说明。我不想要任何基本的答案。我希望你仔细阅读代码,理解它,最后回答它。出于您的考虑,我需要PPPoE的list迭代和Mikrotik的Hotspot。
发布于 2019-02-18 04:29:12
冒着给出“基本”答案的风险,请参阅mikrotik cli命令:
:put [/interface get [find type=pppoe-out]]
我建议在尝试在api中执行之前,先让您想要的命令在cli中工作得很好。
https://stackoverflow.com/questions/54382792
复制相似问题