Home  >  Article  >  Backend Development  >  PHP 施行linux 命令

PHP 施行linux 命令

WBOY
WBOYOriginal
2016-06-13 13:19:41720browse

PHP 执行linux 命令


# vim /etc/rc.d/rc.local
route add default gw 192.168.0.255 eth0
route add -net 10.0.1.0 netmask 255.255.255.0 gw 192.168.0.255 eth0
:wq

我知道PHP 调用系统底层命令 用exec 但是想知道 如何将这三句 同时执行呢?

------解决方案--------------------
最近也在做路由,我们的处理方法是,把文件写到文档里rc.local 里 然后system() 这个文件
------解决方案--------------------
1,脚本script.sh

C/C++ code

#!/bin/bash
route add default gw 192.168.0.255 eth0
route add -net 10.0.1.0 netmask 255.255.255.0 gw 192.168.0.255 eth0 <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn