thinkphp传参第一个回应函数

1.Test.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
 
 
namespace app\sample\controller;
 
 
class Test
{
  public function hello($id,$name){
     echo $id;
     echo '|';
     echo $name."<br>";
      return 'hello,world!';
  }
}

 

2.配置路由

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
 
 
//use think\Route;
Route::get('hello/:id','sample/Test/hello');

  

 

 

 这里遇上一个问题,为什么使用 use think\Route就会错误

 

打开报错

 

 

查看报错

 

 解决方法:

use think\facade\Route;

posted @   阢Lana  阅读(200)  评论(0编辑  收藏  举报
/*别去做新时代教化的奴隶,别轻易去向别人看齐——*/
正在加载今日诗词....
© options->title(); ?>. Typecho 强力驱动'); ?>.
点击右上角即可分享
微信分享提示