PHP code example of rayne / virtual-path
1. Go to this page and download the library: Download rayne/virtual-path 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/ */
rayne / virtual-path example snippets
use Rayne\VirtualPath\JailedPath;
$jailedPath = new JailedPath('/test', $_GET['path'] ?? '');
if ($jailedPath->hasJailbreakAttempt()) {
// Log jailbreak attempt, ban user, …
return;
}
if (is_file($jailedPath->getAbsolutePath())) {
@readfile($jailedPath->getAbsolutePath());
}
use Rayne\VirtualPath\VirtualPath;
$path = new VirtualPath($_GET['path'] ?? '');
$absolutePath = '/test' . $path;