# 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  但是想知道 如何将这三句 同时执行呢?

解决方案 »

  1.   

    这个需要ROOT权限才能操作增加吧?如果是ROOT的话除非你的权限足够.
    将命令写成一个shell 然后调用shell执行.
      

  2.   


    你说的那个root权限 是否可以通过修改visudo获取?实在是不会写shell脚本啊 来不及学了。 
      

  3.   

    如果有权限。直接讲这些字符串内容输出到文件rc.local 
      

  4.   

    最近也在做路由,我们的处理方法是,把文件写到文档里rc.local 里 然后system() 这个文件
      

  5.   

    1,脚本script.sh#!/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 eth02,chown root script.sh3,chmod u+s+x o+x script.sh4,php: system('./script.sh');
      

  6.   


    $abc = `ps -ef`;
    echo $abc;