duandaiqin6080 2018-08-24 16:26
浏览 26
已采纳

带 的字符串导致后续变量错误[关闭]

I have a variable that has , spaces and other symbols in and is causing errors (Notice: Undefined offset: 0) in my code. I am trying to update the terminal note on my MikroTik routers via API but when the note variable has multiple lines and 's and so on, it causes the rest of the code not to work and gives me errors. How can I fix this?

My code:

$config['routeros']['note'] = "\
    
 ------------------------------------------------------------\
    
 Warning! This device is secured by\
    
   _____                          ____                     _ \
    
  / ____|                        |  _ \\                   | |\
    
 | |  __  _ __  ___   ___  _ __  | |_) |  __ _  _ __    __| |\
    
 | | |_ || '__|/ _ \\ / _ \\| '_ \\ |  _ <  / _` || '_ \\  / _` |\
    
 | |__| || |  |  __/|  __/| | | || |_) || (_| || | | || (_| |\
    
  \\_____||_|   \\___| \\___||_| |_||____/  \\__,_||_| |_| \\__,_|\
    
                                              N E T W O R K S\
    
 ------------------------------------------------------------\
    
  \
    
 Unauthorised access is prohibited and shall render the user \
    
 liable to criminal and/or civil prosecution.";

Code snip of PHP file

Output of print_r($config);

Output of print_r($config);

  • 写回答

2条回答 默认 最新

  • douduiti3040 2018-08-28 20:16
    关注

    Haven't been able to sort that issue out as nothing wants to fix it so I have now come up with a solution. I created a function that checks the files on my router, if it exists then it skip but if there is not sys-note.txt file on the router, it will then enable ftp service(if disabled), then upload the sys-note.txt file from my server to the Router and then disable ftp again only if it was disabled to begin with.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?