当前位置:网站首页>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
- 该函数执行后,直接在终端窗口打印命令执行的结果
- 函数的返回值是命令的执行结果的最后一行
边栏推荐
猜你喜欢
![[high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB](/img/dc/a30ccd9943e668aef8c874980a4975.jpg)
[high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB

"The first share of endoscope" broke into IPO two times. Last year, it lost 500million yuan. The commercialization of core products is still in doubt | IPO Express

Zhongyi technology resumed the review status of the gem IPO, and xuxiaofei no longer acted as a practicing lawyer

Koa 快速入門

Interviewer: with the for loop, why do you need foreach??

What is the Valentine's Day gift given by the operator to the product?

瀑布型项目管理最常用的10个小工具,可以自由搭建使用

对补wasm环境的一些测试

Day10 enumeration class and annotation

Configurable FFT system design based on risc-v SOC (1) Introduction
随机推荐
Why install an SSL certificate on a web site?
数字 IC 设计、FPGA 设计秋招笔试题目、答案、解析(1)2022 紫光展锐(上)
【Redis】SortedSet类型
项目研发,有哪些好用的免费脑图工具软件
How to use project Gantt chart to make project report
How to become a senior digital IC Design Engineer (6-5) digital IC Verification: coverage collection
The left toolbar of hbuilder is missing
CTFHub-Web-密码口令-默认口令
【Redis】数据介绍 & 通用命令 & String类型
Why is it recommended that you choose the self research company as much as possible
Ctfhub web password weak password
【学习笔记】子集和问题
Calculate rectangular area
Com3529 test analysis
[redis] get to know redis for the first time
字符串输出
【Redis】Key的层级结构
请问etf基金是否靠谱,安全吗
String attribute exercise
CTFHub-Web-密码口令-弱口令