thinkphp传参第一个回应函数

1.Test.php

<?php


namespace appsamplecontroller;


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 thinkRoute;
Route::get('hello/:id','sample/Test/hello');

  

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

打开报错

查看报错

 解决方法:

use thinkfacadeRoute;

原文地址:https://www.cnblogs.com/zlshy/p/13336356.html