In reinem/nativen PHP sähe das so aus: [code=php] <?php $cpuinfolines = file("/proc/cpuinfo"); foreach($cpuinfolines AS $line) { if (preg_match("/Serial.*:(.*)/", $line, $find)) { echo $find[1]; break; } } ?> [/php]
Natives PHP sollte man immer bevorzugen da schneller.
Du kannst aber auch Konsolen Befehle nutzen: [code=php] <?php exec("/bin/grep '^Serial' /proc/cpuinfo | awk {'print $3'}", $output, $return_var); echo $output[0]; ?> [/php]Sieht kürzer aus, ist aber unsauber/unschön und langsamer
Jetzt mitmachen!
Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!