我有多个 php xpath 代码,加载大约需要 5 到 10 秒。
如果这会有所不同,这是代码:
<?php
$html_string = file_get_contents('https://website.com/');
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($html_string);
libxml_clear_errors();
$xpath = new DOMXpath($dom);
$values = array();
$row = $xpath->query('//*[@id="wsod_forecasts"]/div[2]/p/strong');
foreach($row as $value) {
print($value->nodeValue);
}
?>
我的问题是,是否可以在加载代码时创建简单的加载图像或文本?
像这样:
<image loading script>
<?php ?>
</image loading script end>
有任何想法吗?谢谢。