1 file_example.module file_example_session_contents()

Show the contents of a session file.

This page callback function is called by the Menu API for the path examples/file_example/access_session. Any extra path elements beyond this are considered to be the session path. E.g.: examples/file_example/access_session/foo/bar.txt would be the equivalent of session://foo/bar.txt, which will map into $_SESSION as keys: $_SESSION['foo']['bar.txt']

Menu API will pass in additional path elements as function arguments. You can obtain these with func_get_args().

Return value

string: A message containing the contents of the session file.

See also


Related topics


modules/examples/file_example/file_example.module, line 553
Hook implementations for the File Example module.


function file_example_session_contents() {
  $path_components = func_get_args();
  $session_path = 'session://' . implode('/', $path_components);
  $content = file_get_contents($session_path);
  if ($content !== FALSE) {
    return t('Contents of @path :', 
    array('@path' => check_plain($session_path))) . ' ' .
      print_r($content, TRUE);
  return t('Unable to load contents of: @path', 
  array('@path' => check_plain($session_path)));