怎样访问控制器里的方法,在http中

本人新手一枚,刚接触

我用的是4.211 版本

我修改了routes.php 代码如下:

Route::get('connector/', '\Connector\UserController@index');

我在控制器controllers文件下建立了一个connector文件夹,然后在connector文件下建立了一个UserController.php文件,代码如下:

<?php

class connector/UserController extends \BaseController {

/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
echo '345';
}

/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
}

/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}

}

我想问的是怎样在routes.php 这个文件下配置才能访问控制器里index方法,输出345,

http://www.123.com/connector/index 输出345

谢谢!
已邀请:

雨师

赞同来自:

首先,你的
Route::get('connector/', '\Connector\UserController@index');
中的
Connector

class connector/UserController extends \BaseController {...
中的
connector
为什么大小写不一样的。。。
我觉得如果你命名空间指对合适的控制器方法,就能显示出来的

要回复问题请先登录注册