Home  >  Q&A  >  body text

thinkphp5 controller cannot pass value mdoel

<?php
namespace app\admin\controller;
use app\model\Admin;
use think\Controller;
class Login extends Controller
{
public function login()
                                                                                                                                                                                                  Received data passed to the model layer Model
$ res = (new admin ())-& gt; login (input ('post.'));
}
Return $ This- & gt; fetch () ;
}
}



<?php

namespace app\model;
use think\Loader;

use think\ Model;

class Admin extends Model{

public function login($data){

halt($data);
}
}

?>

HAOHAO2389 days ago1170

reply all(2)I'll reply

  • 郭骏博

    郭骏博2018-03-20 17:40:42

    Why not use the helper function model(Admin)->login();

    reply
    0
  • 韦小宝

    韦小宝2018-03-12 17:41:31

    Is there any error report or prompt


    reply
    0
  • Cancelreply