$file->content($content = null, $format = null)

Setter and getter for the file content

  • $content (string)
  • $format (string)
    json or yaml (defaults to PHP serialization)
  • return (string)

This documentation entry is inherited from the Media class.

Example

$media->content(array(
    'foo' => 'bar',
    'bar' => 'foo'
), 'json');

$media->content('this is an arbitrary string');

// get the data
$content = $media->content();

Note: This method does not save the file, it only stores the new string in memory. You need to use $media->save() to save the file.