我目前有一个看起来像这样的脚本,
$doc = new DOMDocument();
$doc->load( 'sync-img/data.xml' );
$user1 = $doc->getElementsByTagName( "user1" )->item(0)->nodeValue;
$user2 = $doc->getElementsByTagName( "user2" )->item(0)->nodeValue;
$user3 = $doc->getElementsByTagName( "user3" )->item(0)->nodeValue;
$user4 = $doc->getElementsByTagName( "user4" )->item(0)->nodeValue;
$user5 = $doc->getElementsByTagName( "user5" )->item(0)->nodeValue;
$user6 = $doc->getElementsByTagName( "user6" )->item(0)->nodeValue;
当 XML 文件获得新数据时,它会希望脚本或页面刷新。有没有办法将该$doc->load()
部分放入循环并检查它是否每隔几秒钟更新一次,然后强制刷新?