- 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"; //輸出結果
- }
- /*
- int getservbyname ( string $service , string $protocol )
- */
- $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"; //輸出結果
- //開源代碼Vevb.com
- }
新聞熱點
疑難解答