哪位高手能说明一下discuz X2.5 upload/index.php文件思路!
discuz
discuz X2.5 upload/index.php代码如下,主说针对运行步骤(架构思路)说明一下,越详细越好,非常感谢!!!<?php/** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: index.php 27617 2012-02-07 08:24:14Z monkey $ */if(!empty($_SERVER['QUERY_STRING']) && is_numeric($_SERVER['QUERY_STRING'])) { $_ENV['curapp'] = 'home'; $_GET = array('mod'=>'space', 'uid'=>$_SERVER['QUERY_STRING']);} else { $url = ''; $domain = $_ENV = array(); $jump = false; @include_once './data/sysdata/cache_domain.php'; $_ENV['domain'] = $domain; if(empty($_ENV['domain'])) { $_ENV['curapp'] = 'forum'; } else { $_ENV['defaultapp'] = array('portal.php' => 'portal', 'forum.php' => 'forum', 'group.php' => 'group', 'home.php' => 'home'); $_ENV['hostarr'] = explode('.', $_SERVER['HTTP_HOST']); $_ENV['domainroot'] = substr($_SERVER['HTTP_HOST'], strpos($_SERVER['HTTP_HOST'], '.')+1); if(!empty($_ENV['domain']['app']) && is_array($_ENV['domain']['app']) && in_array($_SERVER['HTTP_HOST'], $_ENV['domain']['app'])) { $_ENV['curapp'] = array_search($_SERVER['HTTP_HOST'], $_ENV['domain']['app']); if($_ENV['curapp'] == 'mobile') { $_ENV['curapp'] = 'forum'; if(@$_GET['mobile'] != 'no') { @$_GET['mobile'] = 'yes'; } } if($_ENV['curapp'] == 'default' || !isset($_ENV['defaultapp'][$_ENV['curapp'].'.php'])) { $_ENV['curapp'] = ''; } } elseif(!empty($_ENV['domain']['root']) && is_array($_ENV['domain']['root']) && in_array($_ENV['domainroot'], $_ENV['domain']['root'])) { $_G['setting']['holddomain'] = $_ENV['domain']['holddomain'] ? $_ENV['domain']['holddomain'] : array('www'); $list = $_ENV['domain']['list']; if(isset($list[$_SERVER['HTTP_HOST']])) { $domain = $list[$_SERVER['HTTP_HOST']]; $id = intval($domain['id']); switch($domain['idtype']) { case 'subarea': $_ENV['curapp'] = 'forum'; $_GET['gid'] = $id; break; case 'forum': $_ENV['curapp'] = 'forum'; $_GET['mod'] = 'forumdisplay'; $_GET['fid'] = $id; break; case 'topic': $_ENV['curapp'] = 'portal'; $_GET['mod'] = 'topic'; $_GET['topicid'] = $id; break; case 'channel': $_ENV['curapp'] = 'portal'; $_GET['mod'] = 'list'; $_GET['catid'] = $id; break; } } elseif(count($_ENV['hostarr']) > 2 && $_ENV['hostarr'][0] != 'www' && !checkholddomain($_ENV['hostarr'][0])) { $_ENV['prefixdomain'] = addslashes($_ENV['hostarr'][0]); $_ENV['domainroot'] = addslashes($_ENV['domainroot']); require_once './source/class/class_core.php'; C::app()->init_setting = true; C::app()->init_user = false; C::app()->init_session = false; C::app()->init_cron = false; C::app()->init_misc = false; C::app()->init(); $jump = true; $domain = C::t('common_domain')->fetch_by_domain_domainroot($_ENV['prefixdomain'], $_ENV['domainroot']); $apphost = $_ENV['domain']['app'][$domain['idtype']] ? $_ENV['domain']['app'][$domain['idtype']] : $_ENV['domain']['app']['default']; $apphost = $apphost ? 'http://'.$apphost.'/' : ''; switch($domain['idtype']) { case 'home': if($_G['setting']['rewritestatus'] && in_array('home_space', $_G['setting']['rewritestatus'])) { $url = rewriteoutput('home_space', 1, $apphost, $domain['id']); } else { $url = $apphost.'home.php?mod=space&uid='.$domain['id']; } break; case 'group': if($_G['setting']['rewritestatus'] && in_array('group_group', $_G['setting']['rewritestatus'])) { $url = rewriteoutput('group_group', 1, $apphost, $domain['id']); } else { $url = $apphost.'forum.php?mod=group&fid='.$domain['id'].'&page=1'; } break; } } } else { $jump = true; } if(empty($url) && empty($_ENV['curapp'])) { if(!empty($_ENV['domain']['defaultindex']) && !$jump) { if($_ENV['defaultapp'][$_ENV['domain']['defaultindex']]) { $_ENV['curapp'] = $_ENV['defaultapp'][$_ENV['domain']['defaultindex']]; } else { $url = $_ENV['domain']['defaultindex']; } } else { if($jump) { $url = empty($_ENV['domain']['app']['default']) ? (!empty($_ENV['domain']['defaultindex']) ? $_ENV['domain']['defaultindex'] : 'forum.php') : 'http://'.$_ENV['domain']['app']['default']; } else { $_ENV['curapp'] = 'forum'; } } } }}if(!empty($url)) { $delimiter = strrpos($url, '?') ? '&' : '?'; if(isset($_GET['fromuid']) && $_GET['fromuid']) { $url .= $delimiter.'fromuid='.$_GET['fromuid']; } elseif(isset($_GET['fromuser']) && $_GET['fromuser']) { $url .= $delimiter.'fromuser='.$_GET['fromuser']; } header("HTTP/1.1 301 Moved Permanently"); header("location: $url");} else { require './'.$_ENV['curapp'].'.php';}function checkholddomain($domain) { global $_G; $domain = strtolower($domain); if(preg_match("/^[^a-z]/i", $domain)) return true; $holdmainarr = empty($_G['setting']['holddomain']) ? array('www') : explode('|', $_G['setting']['holddomain']); $ishold = false; foreach ($holdmainarr as $value) { if(strpos($value, '*') === false) { if(strtolower($value) == $domain) { $ishold = true; break; } } else { $value = str_replace('*', '.*?', $value); if(@preg_match("/$value/i", $domain)) { $ishold = true; break; } } } return $ishold;}?>
回复讨论(解决方案)
$_ENV['curapp'] = 'home'; 不知道是什么意思

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.
