Torna indietro
Visualizza codici sorgenti PHP
info.php
<?php
echo(implode(",", [
"a" => 5,
"b" => 10,
"c" => 7,
]));
phpinfo();
?>
script.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<title>Pagina di test</title>
</head>
<body>
<?php
$type_description = [
"integer" => "Un numero intero",
"string" => "Una stringa",
"double" => "Un numero con la virgola",
"NULL" => "Costante null",
"boolean" => "Un booleano",
"array" => "Un array",
];
$vars = [
12,
0.3,
"aaaa",
null,
true,
[1, 2, 3],
];
foreach ($vars as $var) {
$type = gettype($var);
if ($type === "array") {
$repr = implode(",", $var);
} else {
$repr = $var;
}
printf("<p>%s -> %s</p>", $repr, $type_description[$type]);
}
printf("<pre>Array associativo:<br>");
foreach ($type_description as $type => $description) {
printf("<code>[\"%s\"] => %s</code><br>", $type, $description);
}
printf("</pre>");
?>
</body>
</html>
view_scripts.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<title>Visualizza codici sorgenti PHP</title>
</head>
<body>
<a href=".">Torna indietro</a>
<h1>Visualizza codici sorgenti PHP</h1>
<?php
$resources = scandir(".");
foreach ($resources as $res) {
if (str_ends_with($res, ".php")) {
$content = highlight_file($res, true);
printf("<hr />");
printf("<h2>%s</h2>", $res);
printf("<pre>%s</pre>", $content);
}
}
?>
</body>
</html>
zip_test.php
<?php
declare(strict_types=1);
$archive = new ZipArchive();
$ret = $archive.open("test.zip", ZipArchive::CREATE);
if ($ret) {
$archive.addFromString("file.txt", "Ciaoo!!!\n");
} else {
die("ERRORE: {$ret}");
}
echo '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<title>Zip test</title>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<h1>Generato zip!</h1>
</body>
</html>';