Ajax和func_get_args()

Is it possible to use php's func_get_args() to catch 'post(ed)' data from an Ajax function call? (Currently using json to post data).

Hypothetical Ajax call posting data:

.
url: '.../.../...?action=function'
data: { someString: someString }
.
.

php:

function() {
  $arg_list = func_get_args();
  foreach( $arg_list as ....) {
  .
  .
  }
}

i'm currently using isset( $_POST['someString'] ) but I was wondering if i can achieve the same using func_get_args().

Currently, func_get_args isn't catching anything from the ajax call. The 'post' line is directly below this chunk of code and is verifying that ajax has correctly sent the function the correct data. However, func_get_args isn't actually displaying anything on a var_dump. What am i not doing?

Many Thanks

Unfortunately not. func_get_args() looks for function arguments in php stack, while $_POST and $_GET look for http request header parameters.

But if you just want to iterate through $_POST parameters without knowing their names, try this:

foreach( $_POST as $pars ) { 
  if( is_array( $pars ) ) { 
    foreach( $pars as $par ) { 
      echo $par; 
    } 
  } 
  else { echo $pars; 
  } 
}

You should try something like that :

function myAjaxFunction() {
    $args = $_POST;

    if (sizeof($args) > 0)
    {
        foreach ($arg_list as $arg) {
            //
        }
    }
}