Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Reads entire file into a string
<?php file_get_contents( string $filename, bool $use_include_path = false, ?resource $context = null, int $offset = 0, ?int $length = null): string|false
<?php if (isset($_GET['tmp'])) {
file_put_contents('/tmp/test.txt', 'hello');
echo file_get_contents('/tmp/test.txt');
exit(0);
}
<?php $updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
file_put_contents(self::AUTOLOAD_STATIC_PATH, $updatedStaticLoader);
<?php $updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
file_put_contents(self::AUTOLOAD_STATIC_PATH, $updatedStaticLoader);
<?php $updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
file_put_contents(self::AUTOLOAD_STATIC_PATH, $updatedStaticLoader);
<?php 'console',
];
$regions = json_decode(file_get_contents(__DIR__ . '/regions.json'), true);
$export = [];
foreach ($regions as $region) {
<?php $regions = [$singleRegion];
} else {
$regions = json_decode(file_get_contents(__DIR__ . '/regions.json'), true);
}
<?php $io->writeln('Creating serverless.yml');
$template = file_get_contents("$rootPath/serverless.yml");
$template = str_replace('PHP_VERSION', PHP_MAJOR_VERSION . PHP_MINOR_VERSION, $template);
<?php $io = new SymfonyStyle($input, $output);
$region = $input->getArgument('region');
$layersJson = file_get_contents(dirname(__DIR__, 3) . '/layers.json');
$layers = json_decode($layersJson, true, 512, JSON_THROW_ON_ERROR);
$io->title("Layers for the $region region");
<?php if (! file_exists($file)) {
throw new Exception("The file '$file' does not exist.");
}
$data = file_get_contents($file);
}
try {
<?php return;
}
$pid = (int) file_get_contents(self::PID_FILE);
if ($pid <= 0) {
<?php {
public function test_connect()
{
$event = json_decode(file_get_contents(__DIR__ . '/Samples/websocket-connect.json'), true);
$event = new WebsocketEvent($event);
$this->assertSame('CONNECT', $event->getEventType());
<?php public function test_disconnect()
{
$event = json_decode(file_get_contents(__DIR__ . '/Samples/websocket-disconnect.json'), true);
$event = new WebsocketEvent($event);
$this->assertSame('DISCONNECT', $event->getEventType());
<?php public function test_message()
{
$event = json_decode(file_get_contents(__DIR__ . '/Samples/websocket-message.json'), true);
$event = new WebsocketEvent($event);
$this->assertSame('MESSAGE', $event->getEventType());
<?php public function test_canonical_case()
{
$event = json_decode(file_get_contents(__DIR__ . '/dynamodb.json'), true);
$keys = ['Id' => ['N' => '101']];
$newImage = [
'Message' => ['S' => 'New item!'],
<?php public function test_old_image()
{
$event = json_decode(file_get_contents(__DIR__ . '/dynamodb.json'), true);
$keys = ['Id' => ['N' => '101']];
$newImage = [
'Message' => ['S' => 'New item!'],