PHP/自身が動いているサーバがローカル環境かどうか
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#highlightjs
<?php
function isLocal() {
$whitelist = ['127.0.0.1', '::1', 'localhost'];
return in_array($_SERVER['SERVER_ADDR'], $whitelist)...
}
if (isLocal()) {
echo "これはローカル環境です。";
} else {
echo "これは本番環境またはリモート環境です。";
}
?>
----
RIGHT:Today : &counter(today); / Yesterday : &counter(yes...
終了行:
#highlightjs
<?php
function isLocal() {
$whitelist = ['127.0.0.1', '::1', 'localhost'];
return in_array($_SERVER['SERVER_ADDR'], $whitelist)...
}
if (isLocal()) {
echo "これはローカル環境です。";
} else {
echo "これは本番環境またはリモート環境です。";
}
?>
----
RIGHT:Today : &counter(today); / Yesterday : &counter(yes...
ページ名:
1