0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【PHP】IPを判別するプログラム

Last updated at Posted at 2021-05-03

最近PHPを始めたカラボンです。

今回は接続しているIPを判別する方法を教えていきたいと思います。

↓コード↓

<?php

if ($_SERVER["REMOTE_ADDR"] == 'ここにIPを入れる')
{



}
else{

	echo('表示は許可されていません');
	exit;
}
?>


コードの解説


if ($_SERVER["REMOTE_ADDR"] == 'ここにIPを入れる')

if文でIPを判別。{}の中身は空でもよし!


else{

	echo('表示は許可されていません');
	exit;
}

exit;で処理を終了する。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?