当前位置:网站首页>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
边栏推荐
- Handling method of occasional error reporting on overseas equipment
- Troubleshooting of pyinstaller failed to pack pikepdf
- [untitled]
- The 10 most commonly used gadgets for waterfall project management can be built and used freely
- Blog publishing test 1
- 目标检测——ADAS实战
- Prepare for the Blue Bridge Cup - double pointer, BFS
- Kubernetes: container resource requirements and constraints (constraints)
- 指南针手机股票开户哪个券商更安全更方便?
- Day10 enumeration class and annotation
猜你喜欢

MySQL的下载和安装
![[sans titre]](/img/36/2f9319e05157ab6a8dd5aa3bef4505.png)
[sans titre]

Prepare for the Blue Bridge Cup - double pointer, BFS

They all talk about interviews with big factories. When I interview with small factories, I invite people to drink tea?

Koa quick start

Target detection - ADAS practice

如何用项目甘特图,做好项目汇报
![[redis] hash type](/img/8b/2585908318f5fe88b455323d3f392e.png)
[redis] hash type

Day10 enumeration class and annotation

What is the dry goods microservice architecture? What are the advantages and disadvantages?
随机推荐
【Redis】SortedSet类型
String attribute exercise
Prepare for the Blue Bridge Cup - double pointer, BFS
OpenResty 使用介绍
The linkedhashset set makes the elements orderly without repetition
SystemVerilog-结构体(一)
SystemVerilog structure (I)
指南针手机股票开户哪个券商更安全更方便?
Differences between web testing and app testing
Use code binding DataGridView control to display tables in program interface
Talk about the copyonwritearraylist of JUC
Blog publishing test 1
String method exercise
String substitution
mark
Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused
Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin
Some tests on complementary wasm environment
110. 简易聊天室13:聊天室服务端
跨境资讯站