每当我尝试从控制器返回视图时,都会收到此错误“调用未定义的函数View()”

时间:2019-08-12 08:34:59

标签: laravel-4.2

我试图从我的userController类返回一个视图,但是却收到未定义的view()错误。我可以返回字符串,但不能返回“视图”。

/**
 * Display a listing of the resource.
 *
 * @return Response
 */
public function index($id)
{
    //
     return 'yay, you\'re there, and number is '.$id;
}


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


/**
 * 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)
{
    //
}

public function contact(){
    return View('contact');
}

}

我从Windows命令行创建了控制器。我找不到与此相关的问题,因此将不胜感激。哦,我正在使用laravel 4.2。谢谢。

0 个答案:

没有答案