定制 kaleidpixel/jpipallow 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kaleidpixel/jpipallow

最新稳定版本:1.1.0

Composer 安装命令:

composer require kaleidpixel/jpipallow

包简介

A tool designed to generate a .htaccess file that exclusively allows access from Japanese IP addresses, ensuring web content is accessible only within Japan.

README 文档

README

A tool designed to generate a .htaccess file that exclusively allows access from Japanese IP addresses, ensuring web content is accessible only within Japan.

Document

Coding is quite simple. The options are only simple, so you won't get lost.

Options

Option Description
server
default: apache
Apache or Nginx
ipv
default: 0
Specify the version of the IP Address with a single digit (4 or 6).
output_path
default: empty
File path including the name of the file to output the results.
add_before_str
default: empty
.
add_before_str
default: empty
.

Methods

Method Parameter Description
read() bool $echo = false
bool $force = false
Create a list of IP addresses. If already created, cache it for one day.

Basic markup

What follows is the simplest coding.

<?php
require_once dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

use kaleidpixel\JPIPAllow;

$before_str = <<<EOL
## IP address of its In-House server.
Allow from 103.xxx.xxx.xxx
Allow from 203.xxx.xxx.xxx
EOL;

$ip = new JPIPAllow(
	[
		'server'         => 'apache',
		'output_path'    => __DIR__ . DIRECTORY_SEPARATOR . '.htaccess',
		'add_before_str' => $before_str
	]
);

$ip->read(true);

The source code shown above will work on the built-in web server. It also operates in CLI, so choose whichever you prefer.

If you want to run it on the built-in web server, execute the command shown below and then access it with a web browser.

$ php -S localhost:8080

If you want to run it in CLI, execute the command shown below. The path where the file is outputted will be displayed as a result.

$ php ./example/index.php

License

MIT License
Copyright (c) 2023 Kaleid Pixel

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固