$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) {
l | cn |
USER | www |
HOME | /home/www |
SCRIPT_NAME | /index.php |
REQUEST_URI | /news-31.html?l=cn |
QUERY_STRING | l=cn |
REQUEST_METHOD | GET |
SERVER_PROTOCOL | HTTP/1.1 |
GATEWAY_INTERFACE | CGI/1.1 |
REDIRECT_QUERY_STRING | l=cn |
REDIRECT_URL | /news-31.html |
REMOTE_PORT | 51836 |
SCRIPT_FILENAME | /www/wwwroot/www.cvcip.com/public/index.php |
SERVER_ADMIN | webmaster@example.com |
CONTEXT_DOCUMENT_ROOT | /www/wwwroot/www.cvcip.com/public |
CONTEXT_PREFIX | |
REQUEST_SCHEME | http |
DOCUMENT_ROOT | /www/wwwroot/www.cvcip.com/public |
REMOTE_ADDR | 44.204.99.5 |
SERVER_PORT | 80 |
SERVER_ADDR | 172.26.128.113 |
SERVER_NAME | cvcip.com |
SERVER_SOFTWARE | Apache |
SERVER_SIGNATURE | <address>Apache Server at cvcip.com Port 80</address> |
LD_LIBRARY_PATH | /www/server/apache/lib |
PATH | /www/server/panel/pyenv/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin |
HTTP_HOST | cvcip.com |
HTTP_USER_AGENT | claudebot |
HTTP_ACCEPT | */* |
proxy-nokeepalive | 1 |
REDIRECT_STATUS | 200 |
REDIRECT_PATH_INFO | news-31.html |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1711694564.439 |
REQUEST_TIME | 1711694564 |