给你个一个方法ethtool eth0 在显示最后有个字段 Link detected: yes 或者no 表示网线是否插上了 哪怕网卡是down的也都可以编程的话就简单了 popen() 执行获得结果 判断yes or no