getenv() will not work with vlucas/phpdotenv
when set "disable_functions=putenv" at php.ini
disable_functions=putenv
you could be check by phpinfo()
<?php | |
# uploadしてあるzipをサーバーで解凍 | |
# FTPが重いレンサバなどで、`unzip source.zip`が使えない場合などに使う | |
# ext-zipが必要 | |
ini_set("max_execution_time", 300); | |
$zip = new \ZipArchive; | |
if ($zip->open('source.zip') === true){ | |
$zip->extractTo(__DIR__.'/'); | |
$zip->close(); | |
echo 'success'; |
<html> | |
<body> | |
FacebookのOGPキャッシュがDebuggerでも消えない時に使う。 | |
<form action="https://graph.facebook.com/" method="post"> | |
url: <input name="id" ><br> | |
scrape: <input type="text" name="scrape" value="true"><br> | |
<input type="submit"> | |
</form> | |
</body> | |
</html> |
<?php | |
class MiddlewareResolver | |
{ | |
public $queue = []; | |
public function __construct(array $list) | |
{ | |
$this->queue = $list; | |
} |
<form method="post"> | |
<input name="text"> | |
<input type="submit"> | |
</form> | |
<?php | |
!empty($_POST["text"]) && file_put_contents("log.php", date("c>").htmlspecialchars($_POST["text"], ENT_QUOTES, "UTF-8")."\n", FILE_APPEND) && header("location: {$_SERVER['REQUEST_URI']}"); | |
echo @implode('<br>',array_reverse(file("log.php"))); |
find /path/to -atime +30 |grep .tmp|xargs rm |
<?php | |
namespace ¥\¥{ | |
class ¥{ | |
static public function ¥(){ | |
echo "\\ is not ¥".PHP_EOL; | |
} | |
} | |
} | |
namespace { |
<?php | |
// wp-config.phpの先頭あたりに適当につっこむ | |
// YOURNAMEとPASSWORDは適当に書き換える | |
if(preg_match('/wp-login\.php$/', $_SERVER['PHP_SELF'])){ | |
if( !($_SERVER["PHP_AUTH_USER"]=='YOURNAME') || !($_SERVER["PHP_AUTH_PW"]=='PASSWORD') ) { | |
header('WWW-Authenticate: Basic realm="Please Enter Your Password"'); | |
header("HTTP/1.0 401 Unauthorized"); | |
echo "Authorization Required"; | |
die; |
<?php | |
$♨ = "温泉"; | |
function 🍣(){ | |
return "おすし"; | |
} | |
echo "{$♨}いきたいな〜、".🍣()."たべたいなー。".PHP_EOL; | |