You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* 类 DirScanner 测试
|
|
|
|
*/
|
|
|
|
require_once __DIR__ . '/../lib/DirScanner.php';
|
|
|
|
|
|
|
|
|
|
|
|
class DirScannerTest extends DirScanner {
|
|
|
|
|
|
|
|
public function secureLinkTest($path, $secret = '', $userIp = '', $pattern = '') {
|
|
|
|
if (empty($secret)) {
|
|
|
|
$secret = 'Tester';
|
|
|
|
}
|
|
|
|
if (empty($userIp)) {
|
|
|
|
$userIp = '127.0.0.1';
|
|
|
|
}
|
|
|
|
$this->setNginxSecret($secret);
|
|
|
|
$this->setUserIp($userIp);
|
|
|
|
|
|
|
|
if (!empty($pattern)) {
|
|
|
|
$this->setNginxSecureLinkMd5Pattern($pattern);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "\n";
|
|
|
|
echo "==function secureLink==\n";
|
|
|
|
echo "secret: " . $this->getNginxSecret() . "\n";
|
|
|
|
echo "user ip: " . $this->getUserIp() . "\n";
|
|
|
|
echo "timeout: " . $this->getNginxSecureTimeout() . " seconds\n";
|
|
|
|
echo "secure link md5: " . $this->getNginxSecureLinkMd5Pattern() . "\n";
|
|
|
|
echo "path: {$path}\n";
|
|
|
|
$url = $this->getSecureLink($path);
|
|
|
|
echo "secure link: {$url}\n";
|
|
|
|
echo "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--调用测试方法--
|
|
|
|
$scanner = new DirScannerTest();
|
|
|
|
$scanner->secureLinkTest('/default/', 'foo=bar', '127.0.0.1');
|