PHP code example of samsonasik / redirect-handler-module
1. Go to this page and download the library: Download samsonasik/redirect-handler-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
samsonasik / redirect-handler-module example snippets
$redirect = '/foo'; // may be a variable from GET
return $this->redirect()->toUrl($redirect);
class Module
{
public function onBootstrap($e)
{
$app = $e->getApplication();
$eventManager = $app->getEventManager();
$sharedManager = $eventManager->getSharedManager();
$sharedManager->attach('RedirectHandlerModule\Controller\Plugin\Redirect', 'redirect-same-url', function() {
die('You need to use different URL for Redirect');
});
$plugin = $app->getServiceManager()->get('ControllerPluginManager')->get('redirect');
$plugin->setEventManager($eventManager);
}
}