当前位置:网站首页>Exec function of PHP
Exec function of PHP
2022-06-29 02:27:00 【hello php】
The code is as follows :
<?php
$out = ['a'=>'apple','b'=>'banana','c'=>'cat','d'=>'dog'];
$shell_return=null;
$v = exec('netstat -tnlp',$out,$shell_return);
print_r($out);
var_dump($shell_return);
var_dump($v);
The output after execution is as follows :
Array
(
[a] => apple
[b] => banana
[c] => cat
[d] => dog
[0] => Active Internet connections (only servers)
[1] => Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
[2] => tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
[3] => tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 7311/dnsmasq
[4] => tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6987/sshd
[5] => tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 6978/cupsd
[6] => tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 16181/sshd: [email protected]
[7] => tcp6 0 0 :::3306 :::* LISTEN 7361/mysqld
[8] => tcp6 0 0 :::111 :::* LISTEN 1/systemd
[9] => tcp6 0 0 :::8080 :::* LISTEN 7689/httpd
[10] => tcp6 0 0 :::80 :::* LISTEN 7689/httpd
[11] => tcp6 0 0 :::22 :::* LISTEN 6987/sshd
[12] => tcp6 0 0 ::1:631 :::* LISTEN 6978/cupsd
[13] => tcp6 0 0 ::1:6011 :::* LISTEN 16181/sshd: [email protected]
[14] => tcp6 0 0 :::8000 :::* LISTEN 7689/httpd
)
int(0)
string(90) "tcp6 0 0 :::8000 :::* LISTEN 7689/httpd"
Conclusion :
exec($shell, $output, $shell_return)
- $shell: shell command , Such as : 'netstat -tnlp'
- $output: perform shell Output after command , Be careful : If $output There was value before , After appending the output data to the original data
- $shell_return: shell Command execution results , If it works , return 0, Failed to another value
- exec Return value after function execution : return $output The last data of the array
边栏推荐
- Which brokerage is safer and more convenient to open an account for compass mobile stock?
- Table implements alternative adaptation through pseudo classes
- OpenResty 使用介绍
- 目标检测——ADAS实战
- Qt基础教程:数据类型与容器
- Understanding and design of high concurrency
- 项目研发,有哪些好用的免费脑图工具软件
- MySQL details - aggregation and grouping
- 组合数据类型之元组小练习
- 短视频平台常见SQL面试题,你学会了吗?
猜你喜欢

Flex application: realize two rows and five columns of data, self-adaptive

月薪没到30K的程序员必须要背的面试八股,我先啃为敬

Handling method of occasional error reporting on overseas equipment

Talk about the copyonwritearraylist of JUC

对补wasm环境的一些测试

Sysbench Pressure Test Oracle (installation and use examples)

【Redis】SortedSet类型

三角函数计算

学习太极创客 — MQTT 第二章(九)本章测试

China's flexible employment has reached 200million
随机推荐
Matrix eigenvalue and eigenvector solution - eigenvalue decomposition (EVD)
[redis] key hierarchy
mark
Use photoshop2022 to create a wonderful gradient effect for pictures
Table implements alternative adaptation through pseudo classes
Understand flex layout in an article
Download and installation of MySQL
字符串替换
The linkedhashset set makes the elements orderly without repetition
CTFHub-Web-密码口令-弱口令
Differences between web testing and app testing
三角函数计算
Temperature conversion II
字符串方法练习
Which brokerage is safer and more convenient to open a stock account for big smart phones?
KOA Quick Start
【無標題】
11 go Foundation: Interface
Blog publishing test 1
Why should the pointer be null after delete