编程语言
首页 > 编程语言> > thinkphp传参第一个回应函数

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;

标签:传参,use,Route,回应,think,Test,报错,thinkphp,hello
来源: https://www.cnblogs.com/zlshy/p/13336356.html