thinkphp传参第一个回应函数

1.Test.php

<?php


namespace app\sample\controller;


class Test
{
  public function hello($id,$name){
     echo $id;
     echo '|';
     echo $name."<br>";
      return 'hello,world!';
  }
}

 

2.配置路由

<?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 @ 2020-07-18 16:54  阢Lana  阅读(200)  评论(0编辑  收藏  举报
/*别去做新时代教化的奴隶,别轻易去向别人看齐——*/
正在加载今日诗词....
© options->title(); ?>. Typecho 强力驱动'); ?>.