PHP converts each row in an HTML table to an array to achieve the method of collecting tabular data
This example describes how PHP collects tabular data by converting each column of an HTML table into an array. Share to everyone for your reference. Specific as follows:
The following PHP code can convert each row of an HTML table to an array, collecting tabular data
]*?> ' si ', ' ", $table); $table = Preg_replace ("'
]*?> ' si", "", $table); $table = Preg_replace ("'
]*?> ' si", "", $table); $table = Str_replace ("", "{tr}", $table); $table = Str_replace ("", "{td}", $table); Remove HTML markup $table = Preg_replace ("' <[/!") *? [^<>]*?> ' si ', ' ", $table); Remove whitespace characters $table = Preg_replace ("' ([RN]) [s]+ '", "", $table); $table = Str_replace ("", "" ", $table); $table = Str_replace ("", "" ", $table); $table = Explode (' {tr} ', $table); Array_pop ($table); foreach ($table as $key = + $tr) { $td = explode (' {TD} ', $TR); Array_pop ($TD); $TD _array[] = $td; } return $TD _array;}? >
http://www.bkjia.com/PHPjc/979234.html www.bkjia.com true http://www.bkjia.com/PHPjc/979234.html techarticle PHP converts each row of an HTML table into an array to collect tabular data The example in this paper describes how PHP can collect tabular data by converting each column of the HTML table into an array. Share to the big ...