$path = $this->rule->parseUrlPath($url);
if (empty($path)) {
return [null, null];
}
// 解析控制器
$controller = !empty($path) ? array_shift($path) : null;
if ($controller && !preg_match('/^[A-Za-z0-9][\w|\.]*$/', $controller)) {
throw new HttpException(404, 'controller not exists:' . $controller);
}
// 解析操作
$action = !empty($path) ? array_shift($path) : null;
$var = [];
// 解析额外参数
if ($path) {
preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) {
USER | nginx |
HOME | /var/lib/nginx |
PATH_TRANSLATED | /data/www/changtou/public%20 |
ORIG_SCRIPT_FILENAME | /data/www/changtou/public/index.php// |
ORIG_SCRIPT_NAME | /index.php// |
ORIG_PATH_INFO | //%20 |
HTTP_ACCEPT_ENCODING | gzip |
HTTP_REFERER | https://jhsyboy.com |
HTTP_USER_AGENT | Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html) |
HTTP_CONNECTION | close |
HTTP_X_FORWARDED_FOR | 154.89.104.226 |
HTTP_X_REAL_IP | 154.89.104.226 |
HTTP_HOST | jhsyboy.com:80 |
REDIRECT_STATUS | 200 |
SERVER_NAME | 192.168.200.121 |
SERVER_PORT | 80 |
SERVER_ADDR | 192.168.200.121 |
REMOTE_PORT | 7029 |
REMOTE_ADDR | 192.168.200.50 |
SERVER_SOFTWARE | nginx/1.20.1 |
GATEWAY_INTERFACE | CGI/1.1 |
REQUEST_SCHEME | http |
SERVER_PROTOCOL | HTTP/1.0 |
DOCUMENT_ROOT | /data/www/changtou/public |
DOCUMENT_URI | /index.php// |
REQUEST_URI | /%20 |
CONTENT_LENGTH | |
CONTENT_TYPE | |
REQUEST_METHOD | GET |
QUERY_STRING | |
SCRIPT_NAME | // |
SCRIPT_FILENAME | /data/www/changtou/public/index.php |
PATH_INFO | %20 |
FCGI_ROLE | RESPONDER |
PHP_SELF | //%20 |
REQUEST_TIME_FLOAT | 1661929330.1754 |
REQUEST_TIME | 1661929330 |