用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > php教程

php中 getservbyport getservbyname函数实例

时间:2015-01-23  来源:西部数据  作者:西部数据
  1. string getservbyport ( int $port , string $protocol ) 
  2.  
  3. */ 
  4. $services=array('80','21','22','23','25','143');      //定义数组 
  5. foreach($services as $service)         //循环读取内容 
  6.   $protocol=getservbyport($service,'tcp');       //返回端口号对应的协议 
  7.   echo $service.":".$protocol."<br/>n";       //输出结果 
  8.  
  9. /* 
  10. int getservbyname ( string $service , string $protocol ) 
  11. */ 
  12.  
  13. $services=array('http','ftp','ssh','telnet','imap'
  14. 'smtp','nicname','gopher','finger','pop3','www');       //定义一个数组 
  15. foreach($services as $service)          //循环读取内容 
  16.   $port=getservbyname($service,'tcp');        //获取数组元素对应端口 
  17.   echo $service.":".$port."<br/>n";         //输出结果 
  18.   //开源代码phpfensi.com 
  19. }
来顶一下
返回首页
返回首页
推荐资讯
WiFi太不安全:7岁女孩11分钟内入侵公共网络 WiFi太不安全:7岁女孩11分钟内入侵近期刚刚发布研究说WiFi网络能获得人们手机里多少私人信息,
不服跑个分?人工智能也出现“刷分”乱象 不服跑个分?人工智能也出现“刷分2014年,人工智能领域突然爆发,成为了科研和科技创业的热门
相关文章
    无相关信息
栏目更新
栏目热门