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?

nginx - Under ThinkPHP3.2, why does it prompt that the controller xxx cannot be loaded when getting the parameter s=xxx?

WBOY
Release: 2016-08-10 09:07:22
Original
1935 people have browsed it

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>
Copy after login
Copy after login

After looking at the source code of the framework for a long time, I still can’t find the reason. Please ask why QAQ

Reply content:

Url is http://rg.com/Admin/index?s=xxx

where

s represents the search keyword, which may be any value
Visit the above link tips

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>
Copy after login
Copy after login

After looking at the source code of the framework for a long time, I still can’t find the reason. Please ask why QAQ

Frame built-in URLs use keywords

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>
Copy after login

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>
Copy after login

Please check the official documentation for details

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template