Skip to content

Instantly share code, notes, and snippets.

@evillemez
Created March 29, 2014 18:07
Show Gist options
  • Save evillemez/9859256 to your computer and use it in GitHub Desktop.
Save evillemez/9859256 to your computer and use it in GitHub Desktop.
getting file contents in node/php

Logging the contents of a file, and printing some random stuff:

JS (in node):

var fs = require('fs');

fs.readFile('/foo.txt', function(contents) {
	console.log(contents);
});

console.log("pwn3d");

PHP:

<?php

echo file_get_contents('/foo.txt');
echo "pwn3d";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment