1<style>2 3 ul{4width:100%;;5 }6 li{7 float:Left ;8Margin-right:5px;;9 Ten } One #content{ Awidth:100%; - - } the</style> -<?PHP - //$dir = dirname (GETCWD ()); - //$filepath = $dir. ' \ \ '. ' Communication '. ' \\‘.‘ Mod_index.php '; + Header("content-type:text/html; Charset=utf-8 "); - $path=dirname(GETCWD()); + $direction=dir($path); A at $allow=Array( - - ); - $result=Array(); -Gettables ($direction); - $direction-close (); inPrintTable ($result); - to + /** - * Get the table name used by all PHP file query statements in this directory the * @param $direction directory control handle * */ $ functionGettables ($direction){Panax Notoginseng Global $allow,$result; - while(($file=$direction->read ())! =false){ the $tables=Array(); + if($file! = '. ' &&$file! = '. ' &&Strpos($file,‘.‘) &&strstr($file,‘.‘) = = '. php '){ A $filepath= GetPath ($direction->path,$file); the $content=file_get_contents($filepath); + Preg_match_all("/db_tablepre. [\ ' | '] ([^\s ' \ "]*)/I",$content,$tables); - $tables=Array_unique($tables[1]); $ $result=Array_merge($result,$tables); $}ElseIf(Is_dir($childdir= GetPath ($direction->path,$file))){ - if(In_array($file,$allow)){ - $dir=dir($childdir); theGettables ($dir); - $dir-close ();Wuyi}Else{ the Continue; - } Wu } - } About } $ - - /** Get Completion path - * @param $dir A * @param $file + * @return String the */ - functionGetPath ($dir,$file){ $ return $dir.‘ \\‘.$file; the } the the /** Print Form the * @param $arr - */ in functionPrintTable ($arr){ the $arr=Array_unique($arr); the $html= ' <div id= ' content ><ul> '; About $num= 0; the foreach($arr as $k){ the $html. = "<li>$num:".$k. "</li>"; the $num++; + } - $html. = ' </ul></div> '; the Echo $html;Bayi Echo"The number of <div style= ' Display:inherit ' > Data tables is:".Count($arr)." </div> "; the}
Use functions to query the names of all data tables used in the project