1

simple_html_dom.php用来从 html 中获取值。

<?php
// Create a DOM object; You must do this for each way
include('dom/simple_html_dom.php');
// Load HTML from a string
$html = new simple_html_dom();
$html->load_file('test.html');
$reasoncode = $html->find('input[name=reasonCode]');

foreach($reasoncode as $e){
    $results[] = $e->value;
}
?>

在上面的代码中,如果我打印$results[],它会返回我需要的正确值。但是如果我 print $reasoncode,它会打印一个长的 html 对象数组并在无限循环中运行。

4

0 回答 0