Home >Backend Development >PHP Tutorial >nginx - Under ThinkPHP3.2, why does it prompt that the controller xxx cannot be loaded when getting the parameter s=xxx?
Url is http://rg.com/Admin/index?s=xxx
where s
represents the search keyword, which may be any value
Tips for accessing the above link
Unable to load controller:
?
This is very strange, how does it have anything to do with the controller? Isn’t the controller
c
The content of the public configuration file (Common/Conf/config.php
) is as follows:
<code class="php">return array( 'URL_MODEL' => 2, // 重写模式 'VAR_MODULE' => '_m', // 默认模块获取变量 'VAR_CONTROLLER' => '_c', // 默认控制器获取变量 'VAR_ACTION' => '_a', // 默认操作获取变量 );</code>
After looking at the source code of the framework for a long time, I still can’t find the reason. Please ask why QAQ
Url is http://rg.com/Admin/index?s=xxxwhere
s represents the search keyword, which may be any value
Visit the above link tips
This is very strange, how does it have anything to do with the controller? Isn’t the controller
c?) is as follows:
The content of the public configuration file (
Common/Conf/config.php
<code class="php">return array( 'URL_MODEL' => 2, // 重写模式 'VAR_MODULE' => '_m', // 默认模块获取变量 'VAR_CONTROLLER' => '_c', // 默认控制器获取变量 'VAR_ACTION' => '_a', // 默认操作获取变量 );</code>
After looking at the source code of the framework for a long time, I still can’t find the reason. Please ask why QAQ
ThinkPHP/Conf/convention.php has several configuration items
<code>/* 系统变量名称设置 */ 'VAR_MODULE' => 'm', // 默认模块获取变量 'VAR_ADDON' => 'addon', // 默认的插件控制器命名空间变量 'VAR_CONTROLLER' => 'c', // 默认控制器获取变量 'VAR_ACTION' => 'a', // 默认操作获取变量 'VAR_AJAX_SUBMIT' => 'ajax', // 默认的AJAX提交变量 'VAR_JSONP_HANDLER' => 'callback', 'VAR_PATHINFO' => 's', // 兼容模式PATHINFO获取变量例如 ?s=/module/action/id/1 后面的参数取决于URL_PATHINFO_DEPR 'VAR_TEMPLATE' => 't', // 默认模板切换变量 'VAR_AUTO_STRING' => false, // 输入变量是否自动强制转换为字符串 如果开启则数组变量需要手动传入变量修饰符获取变量</code>
When using get in tp, you cannot use a, c, m, s, nor does t seem to work. Used by the framework.
Your suffix is gone. If the normal connection is in rewrite mode, domain name/controller name/method name/ followed by parameters. If such problems often occur, it is recommended to use the U method to generate the connection. For example
<code>U('Index/index',array('参数名'=>'参数值','参数名1'=>'参数值1'));</code>
Please check the official documentation for details