namespace app\index\controller;
use think\Controller;
use think\Request;
class Blog extends Controller
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'index';
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'create';
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'save';
}
/**
* 显示指定的资源
*
* @param int $blog_id
* @return \think\Response
*/
public function read($blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'read'.' '.$blog_id;
}
/**
* 显示编辑资源表单页.
*
* @param int $blog_id
* @return \think\Response
*/
public function edit($blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'edit'.' '.$blog_id;
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $blog_id
* @return \think\Response
*/
public function update(Request $request, $blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'update'.' '.$blog_id;
}
/**
* 删除指定资源
*
* @param int $blog_id
* @return \think\Response
*/
public function delete($blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'delete'.' '.$blog_id;
}
public function miss()
{
echo 'Blog 路由方法不存在';
}
}
namespace app\index\controller;
use think\Controller;
use think\Request;
class Comment extends Controller
{
public function create($blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is create, this is a Comment'.' blog_id='.$blog_id;
}
public function save(Request $request,$blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is save, this is a Comment'.' blog_id='.$blog_id;
}
public function read($id, $blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is read, this is a Comment'.' id ='.$id.' blog_id='.$blog_id;
}
public function edit($id, $blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is edit, this is a Comment'.' id ='.$id.' blog_id='.$blog_id;
}
public function update(Request $request, $id, $blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is update, this is a Comment'.' id ='.$id.' blog_id='.$blog_id;
}
public function delete($id, $blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is delete, this is a Comment'.' id ='.$id.' blog_id='.$blog_id;
}
public function index($blog_id)
{
echo $this->request->param('hi').'
';
echo $this->request->param('name').'
';
echo 'method is index, this is a Comment'.' blog_id='.$blog_id;
}
}