控制器会变?很简单的测试,为什么打印这个

浏览:559 发布日期:2015/04/03 分类:求助交流
TP版本是最新的,刚从官网下的3.2.3
入口index.php<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用入口文件

// 检测PHP环境
if(version_compare(PHP_VERSION,'5.3.0','<'))  die('require PHP > 5.3.0 !');

// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
define('APP_DEBUG',True);

// 定义应用目录
define('APP_PATH','./Application/');

define('BIND_MODULE','Home');

// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';

// 亲^_^ 后面不需要任何代码了 就是如此简单
config.php<?php
return array(
    'URL_MODEL' => 2,
);
IndexController.class.php<?php
namespace Home\Controller;

use Think\Controller;

class IndexController extends Controller
{
    function _initialize()
    {
        echo CONTROLLER_NAME . '===' . ACTION_NAME;
    }

    function index()
    {

    }

    function ceshi()
    {

    }
}
CeshiController.class.php<?php
namespace Home\Controller;

use Think\Controller;

class CeshiController extends Controller
{
    function _initialize()
    {
        echo CONTROLLER_NAME . '===' . ACTION_NAME;
    }

    function index()
    {

    }

    function ceshi()
    {

    }
}
访问链接http://localhost/Index/ceshi
问题在这,竟然打印出Ceshi===index
除了这个地址,其它打印都没问题

附.htaccess<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
最后查了一下,好像是系统环境的问题。具体是什么问题也不清楚。在入口文件得到$_SERVER中的pathinfo就不对
[REQUEST_URI] => /Index/ceshi/ [script_NAME] => /index.php [PATH_INFO] => /ceshi/
最佳答案
评论( 相关
后面还有条评论,点击查看>>