首先是一个配置文件index.php
<?php define('THINK_PATH','ThinkPHP/');
define('APP_NAME','php100');
define('APP_PATH','.'); require(THINK_PATH."/ThinkPHP.php"); $App = new App();
$App->run();
?>
然后是在Lib文件夹下的一个控制器IndexAction.class.php
<?php
// 本类由系统自动生成,仅供测试用途
class IndexAction extends Action{
    public function index(){
        header("Content-Type:text/html; charset=utf-8");
        echo "<div style='font-weight:normal;color:blue;float:left;width:345px;text-align:center;border:1px solid silver;background:#E8EFFF;padding:8px;font-size:14px;font-family:Tahoma'>^_^ Hello,欢迎使用<span style='font-weight:bold;color:red'>ThinkPHP</span></div>";
    }
    public function show(){
     echo "123";
    }
}
?>
然后再网页上输入http://localhost/php100/index.php  显示的是^_^ Hello,欢迎使用ThinkPHP那我要调用show方法 是在上面的网址上加?a=show,这时出现1.非法操作SHOW:如下
系统发生错误 您可以选择 [ 重试 ] [ 返回 ] 或者 [ 回到首页 ][ 错误信息 ]
非法操作show
就是这个问题

解决方案 »

  1.   

    index.php只是一个入口文件  记得TP的规则好像是这样子
    http://localhost/php100/index.php/index/show
      

  2.   

    我写成这样http://localhost/php100/index.php?a=show运行后,网址就是解析成你说的那样,然后就出现非法操作show了
      

  3.   

    http://localhost/php100/index.php/index(控制器名称,就是IndexAction extends Action里的IndexAction 不要Action)/show(控制器里对应的方法)
      

  4.   

    后面还有这个 [ TRACE ][11-10-08 18:41:10] () Action->__call(show, Array)
    [11-10-08 18:41:10] () IndexAction->show()
    [11-10-08 18:41:10] D:\wamp\www\php100\Runtime\~runtime.php (2) call_user_func(Array)
    [11-10-08 18:41:10] D:\wamp\www\php100\Runtime\~runtime.php (2) App::exec()
    [11-10-08 18:41:10] D:\wamp\www\php100\index.php (10) App::run()
      

  5.   

    没有使用过 ThinkPHP尝试改成
      public function show(){
      return "123";
      }
      

  6.   


    http://localhost/php100/index.php?a=Index&m=show 这个是TP中url的普通模式。
      

  7.   

    王二给的网址写上后 又变成无法加载模块show了
    TRACE ]
     
    [11-10-09 12:32:10] D:\wamp\www\php100\Runtime\~runtime.php (2) App::exec()
     [11-10-09 12:32:10] D:\wamp\www\php100\index.php (10) App::run()
      

  8.   

    第一步:
    在IndexAction下新建一个方法
    public function show()
    {
         echo 'hello world';
    }第二步:
    http://localhost/php100/index.php/index/show (如果你没修改任何配置的话,系统默认是PHTH_INFO模式,并且URL_MODEL 是2模式)
    或者使用
    http://localhost/php100/index.php?m=Index&a=show
      

  9.   

    楼上的小毛球, 我的配置是URL_MODEL'      => 1,       // URL访问模式,可选参数0、1、2、3,代表以下四种模式:
        // 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE  模式);应该没错吧 还是同样的问题
      

  10.   

    写错了,应该是 
    http://localhost/php100/index.php?m=Index&a=show
    m是模块名,a是方法名
      

  11.   

    pathinfo 模式,先看看php.ini 里 pathinfo 模式开启没?如果没开启就把这功能开启了然后把web服务器重启下
      

  12.   

    貌似是这样···
    /index/show
      

  13.   

    问题解决了 ,是我自己太蠢了,我说的文件都在thinkphp自带的。
    正确的运行应该是在新生成的lib文件夹中去修改,谢谢大家的帮忙了!!谢谢