PHP+Ajax实时自动检测是否联网的方法_PHP教程

WBOY
Release: 2016-07-13 09:47:43
Original
758 people have browsed it

PHP+Ajax实时自动检测是否联网的方法

   本文实例讲述了PHP+Ajax实时自动检测是否联网的方法。分享给大家供大家参考。具体实现方法如下:

  html部分代码:

  ?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

/p>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

PHP+Ajax实时自动检测是否联网

PHP+Ajax实时自动检测是否联网

当前网络状态:

  php部分代码:

  ?

1

2

3

4

5

6

7

8

9

10

11

public function getNetLink(){

header("cache-control:no-cache,must-revalidate");

header("Content-Type:text/html;charset=utf-8");

$file=fopen("http://www.baidu.com/", "r");

if (!$file){

$shownetlink = "网络连接失败";

}else{

$shownetlink = "网络连接正常";

}

echo $shownetlink;

}

  希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1025328.htmlTechArticlePHP+Ajax实时自动检测是否联网的方法 本文实例讲述了PHP+Ajax实时自动检测是否联网的方法。分享给大家供大家参考。具体实现方法如下:...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!