When the URL is accompanied by the parameter "C", how can $_request not get the value?
But if you change the parameter to another name, such as the uppercase "C", you can get the value.
Excuse me, what's going on?
Reply content:
When the URL is accompanied by the parameter "C", how can $_request not get the value?
But if you change the parameter to another name, such as the uppercase "C", you can get the value.
Excuse me, what's going on?
It's used, right thinkPHP
? thinkPHP
by default, the name of the GET
act in the parameter is fetched c
controller
and dispatched as such. You can config
change the value in the file VAR_CONTROLLER
to select other parameters as the controller
name, so that the C parameter will not be prevented from passing.
In the framework of thinkphp, the request Distribution section needs to parse the M c a parameter, and after parsing it removes the corresponding parameter from the $_get array
path\to\thinkphp\library\think\think.class.php
/** * 应用程序初始化 * @access public * @return void */ static public function start() { ... // 运行应用 App::run(); }
path\to\thinkphp\library\think\app.class.php
/** * 运行应用实例 入口文件使用的快捷方法 * @access public * @return void */ static public function run() { ... App::init(); ... }
/** * 应用程序初始化 * @access public * @return void */ static public function init() { ... // URL调度 Dispatcher::dispatch(); ...
path\to\thinkphp\library\think\dispatcher.class.php
/** * URL映射到控制器 * @access public * @return void */ static public function dispatch() { ... // 获取模块名称 define('MODULE_NAME', defined('BIND_MODULE')? BIND_MODULE : self::getModule($varModule)); ... // 获取控制器的命名空间(路径) define('CONTROLLER_PATH', self::getSpace($varAddon,$urlCase)); // 获取控制器和操作名 define('CONTROLLER_NAME', defined('BIND_CONTROLLER')? BIND_CONTROLLER : self::getController($varController,$urlCase)); define('ACTION_NAME', defined('BIND_ACTION')? BIND_ACTION : self::getAction($varAction,$urlCase)); ...
/** * 获得实际的控制器名称 */ static private function getController($var,$urlCase) { ... $controller = (!empty($_GET[$var])? $_GET[$var]:C('DEFAULT_CONTROLLER')); unset($_GET[$var]); ... }
The code that gets the module and the action method is similar.
In fact, should not be directly from the $_get to fetch data, because if you use PathInfo URL mode or rewrite URL pattern when these parameters are not $_get
What's your post?