<?php

// 需求:因为系统涉及大量的文档知识库,用户可以在线进行查看。为了验证文档是否正常打开。先需要从数据库取出路径和文件名,判断是否可以从对应的路径下打开文件。
header("Content-Type: text/html; charset=utf8");
$con = mysql_connect("数据库地址","用户名","密码");
if (!$con)
{
echo 'Could not connect: ' . mysql_error();
}
else{

mysql_select_db("数据库", $con);//输入选择的数据库
mysql_query("set names utf8");
$pathone=mysql_query("select Path,Name from file");
echo mysql_num_rows($pathone);
while($tmpRow = mysql_fetch_array($pathone))
{

$url = "https://www.test.com/test/".$tmpRow['fPath']."/".$tmpRow['fName'];
$headers = @get_headers($url);
if($headers[0] == 'HTTP/1.1 404 Not Found')
{
echo "URL not Exists".$url.'</br>';
}
else
{
echo "URL Exists".'</br>';
}
}
}
mysql_close($con);


?>

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-09-09
  • 2021-11-02
  • 2021-12-25
相关资源
相似解决方案