如何在同一页面中使用$ _GET [关闭]

My pseudo code is as follows:

if($_GET['action'] == 'list'){

do function getFileList($dir)

else

do nothing
 exit;
 }
require_once "./dir.php";
require_once "./echo.php";

function getFileList($dir)
  {
 }

Your psuedo code is almost there.

require_once "./dir.php";
require_once "./echo.php";

function getFileList($dir)
{
   /* ... */   
}

if($_GET['action'] == 'list') {
   getFileList($dir);
}

Are you asking how to send a variable via GET to a PHP file from within the same PHP file? You can create a form that submits to itself: http://www.tellingmachine.com/post/Simple-self-submitting-PHP-forms.aspx.

If you are looking to do something else, please provide additional details.