当前位置:网站首页>PHP的system函数
PHP的system函数
2022-06-29 02:23:00 【hello php】
PHP代码如下:
<?php
$v = system('netstat -tnlp',$shell_return);
var_dump($shell_return);
var_dump($v);
执行结果:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 7311/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6987/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 6978/cupsd
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 16181/sshd: [email protected]
tcp6 0 0 :::3306 :::* LISTEN 7361/mysqld
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::8080 :::* LISTEN 7689/httpd
tcp6 0 0 :::80 :::* LISTEN 7689/httpd
tcp6 0 0 :::22 :::* LISTEN 6987/sshd
tcp6 0 0 ::1:631 :::* LISTEN 6978/cupsd
tcp6 0 0 ::1:6011 :::* LISTEN 16181/sshd: [email protected]
tcp6 0 0 :::8000 :::* LISTEN 7689/httpd
int(0)
string(90) "tcp6 0 0 :::8000 :::* LISTEN 7689/httpd"
结论如下:
system($shell, $shell_return):
- $shell: 是shell命令, 如'netstat -tnlp'
- $shell_return: shell命令执行的返回结果,命令执行成功返回0, 否则不为0
- 该函数执行后,直接在终端窗口打印命令执行的结果
- 函数的返回值是命令的执行结果的最后一行
边栏推荐
猜你喜欢

How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script

Koa 快速入门

Tiflash compiler oriented automatic vectorization acceleration

Introduction to openresty

Differences between web testing and app testing

對補wasm環境的一些測試

目标检测——ADAS实战

高并发的理解与设计方案
![[MySQL practice of high concurrency, high performance and high availability of massive data -9] - transaction concurrency control solutions lbcc and mvcc](/img/62/77c2274db4f92ad1d88901e149251c.jpg)
[MySQL practice of high concurrency, high performance and high availability of massive data -9] - transaction concurrency control solutions lbcc and mvcc

CTFHub-Web-密码口令-默认口令
随机推荐
Use code binding DataGridView control to display tables in program interface
String substitution
[redis] sortedset type
How to become a senior digital IC Design Engineer (5-1) theory: clock technology, reset Technology
Learning Tai Chi Maker - mqtt Chapter II (IX) test of this chapter
[learn FPGA programming from scratch -49]: Vision - how is the chip designed?
QT basics tutorial: qstringlist
Flex application: realize two rows and five columns of data, self-adaptive
Examen final de troisième année
Understand flex layout in an article
为什么要在网站上安装SSL证书?
Qt基础教程:QStringList
110. simple chat room 13: chat room server
Dialogue with opensea co creation Alex: we still only touch the tip of the iceberg of NFT capability | chain catcher
I have summarized some experiences from the whole process of R & D platform splitting
跨境资讯站
Koa 快速入门
Trigonometric function calculation
String segment combination
【Redis】List类型