0
如何使用file_get_contents
php中的值作爲數字?如何使用file_get_contents php中的值作爲數字?
我想用$val
在這種情況下= 50.0001
加上20
它會導致70.0001
但是當我測試它的顯示0
爲什麼呢?我能怎麼做 ?
<?php
$html = file_get_contents('https://www.example.com');
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($html);
$finder = new DomXPath($doc);
$node = $finder->query("//*[contains(@class, 'test')]");
$val = $doc->saveHTML($node->item(0));
$result = $val + 20;
echo $result;
?>
<span class="test">50.0001</span>
你可以var_dump到$ node和$ val嗎? –