php中 getservbyport getservbyname函数实例 |
时间:2015-01-23 来源:西部数据 作者:西部数据 |
|
- string getservbyport ( int $port , string $protocol )
-
- */
- $services=array('80','21','22','23','25','143');
- foreach($services as $service)
- {
- $protocol=getservbyport($service,'tcp');
- echo $service.":".$protocol."<br/>n";
- }
-
-
-
-
-
- $services=array('http','ftp','ssh','telnet','imap',
- 'smtp','nicname','gopher','finger','pop3','www');
- foreach($services as $service)
- {
- $port=getservbyname($service,'tcp');
- echo $service.":".$port."<br/>n";
-
- }
|
|
|
|