承接 settermjd/url-redirector 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

settermjd/url-redirector

Composer 安装命令:

composer require settermjd/url-redirector

包简介

This is a simple package that simplifies the process of performing redirects from one absolute URL to another. It's not meant to be, in any way, sophisticated.

README 文档

README

This is a simple package that simplifies the process of performing redirects from one absolute URL to another. It's not meant to be, in any way, sophisticated.

Installing

To install the module, use Composer by running composer require settermjd/url-redirector.

Getting Started

The constructor takes two arguments:

  1. An array. This is a simple key/value list of URLs that require redirecting, and where they should be redirected to
  2. The currently requested URL.

The package provides two functions:

  • requiresRedirect(): This tests if the requested URL requires a redirect
  • getRedirectUrl(): This retrieves the URL that the current request should be redirected to

If you just want to test, use the first, if you want to redirect, use the second, which uses the first internally.

After initializing the object, pass the return value from getRedirectUrl() to PHP's header function, as in the example below, and the request will be redirected.

<?php

require_once('vendor/autoload.php');

$redirectList = [];
$requestUrl = '';  // the requested URL

$redirector = new Redirector\Redirector($redirectList, $requestUrl);

if ($redirector->requiresRedirect()) {
    header(sprintf('Location: %s', $redirector->getRedirectUrl()));
    exit;
}

Running the Tests

To run the unit tests, run composer test.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-07-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固